diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 91063880..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,627 +0,0 @@ -# Changelog - -[npm history][1] - -[1]: https://www.npmjs.com/package/@google-cloud/nodejs-vision?activeTab=versions - -## [3.1.0](https://github.com/googleapis/nodejs-vision/compare/v3.0.1...v3.1.0) (2023-01-14) - - -### Features - -* Added SuggestConversationSummary RPC ([#1081](https://github.com/googleapis/nodejs-vision/issues/1081)) ([e46aaec](https://github.com/googleapis/nodejs-vision/commit/e46aaec37c70c3fa05c7b390bb06fddde30fc4ee)) - - -### Bug Fixes - -* **deps:** Update dependency natural to v6 ([#1085](https://github.com/googleapis/nodejs-vision/issues/1085)) ([f9bdd84](https://github.com/googleapis/nodejs-vision/commit/f9bdd849ad0e9c0724deeb52eea8791a0186ed9d)) -* **deps:** Update dependency redis to ~4.5.0 ([#1072](https://github.com/googleapis/nodejs-vision/issues/1072)) ([109fed0](https://github.com/googleapis/nodejs-vision/commit/109fed01d6ddefe81e352861f482b207e79fd10b)) -* **deps:** Use google-gax v3.5.2 ([#1073](https://github.com/googleapis/nodejs-vision/issues/1073)) ([47281f6](https://github.com/googleapis/nodejs-vision/commit/47281f6bcf25d8223d065ec99b8db51624c34cbd)) -* Regenerated protos JS and TS definitions ([#1077](https://github.com/googleapis/nodejs-vision/issues/1077)) ([4f7610f](https://github.com/googleapis/nodejs-vision/commit/4f7610f253ceb694abfb41aa2a6a2e02493e1c52)) - -## [3.0.1](https://github.com/googleapis/nodejs-vision/compare/v3.0.0...v3.0.1) (2022-09-21) - - -### Bug Fixes - -* Preserve default values in x-goog-request-params header ([#1044](https://github.com/googleapis/nodejs-vision/issues/1044)) ([a5baeca](https://github.com/googleapis/nodejs-vision/commit/a5baeca8fc50b9d805b55515db493c86cff26299)) - -## [3.0.0](https://github.com/googleapis/nodejs-vision/compare/v2.4.2...v3.0.0) (2022-09-01) - - -### ⚠ BREAKING CHANGES - -* Update library to use Node 12 (#1016) -* BatchAnnotateImagesRequest.requests is required (#1011) - -### Features - -* Add TextDetectionParams.advanced_ocr_options ([#1034](https://github.com/googleapis/nodejs-vision/issues/1034)) ([828f045](https://github.com/googleapis/nodejs-vision/commit/828f045563eff5668dc95f628745716978759788)) -* Support regapic LRO ([a5f8f72](https://github.com/googleapis/nodejs-vision/commit/a5f8f72328655c7959475d0258df164b576af570)) - - -### Bug Fixes - -* Allow passing gax instance to client constructor ([#1042](https://github.com/googleapis/nodejs-vision/issues/1042)) ([4cc32dc](https://github.com/googleapis/nodejs-vision/commit/4cc32dc2068cd9490b28a8869a1d6de6c7a7b0c3)) -* BatchAnnotateImagesRequest.requests is required ([#1011](https://github.com/googleapis/nodejs-vision/issues/1011)) ([574f43e](https://github.com/googleapis/nodejs-vision/commit/574f43ecfadab77aa992aae2a24e36a3bb9f7b22)) -* Better support for fallback mode ([#1037](https://github.com/googleapis/nodejs-vision/issues/1037)) ([ea578e7](https://github.com/googleapis/nodejs-vision/commit/ea578e784271fd2f68c330850f64d1d9e406625d)) -* Change import long to require ([#1038](https://github.com/googleapis/nodejs-vision/issues/1038)) ([b57b334](https://github.com/googleapis/nodejs-vision/commit/b57b334c35591e73f875ef61f375f452e78ce094)) -* **deps:** Update dependency redis to ~4.3.0 ([#1039](https://github.com/googleapis/nodejs-vision/issues/1039)) ([ea26d33](https://github.com/googleapis/nodejs-vision/commit/ea26d3349b1e2db8eb021924b1ee2406f135b712)) -* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-vision/issues/1553)) ([#1041](https://github.com/googleapis/nodejs-vision/issues/1041)) ([4de6e42](https://github.com/googleapis/nodejs-vision/commit/4de6e42aada9228574bc2f50d6b6e10f7f244b4d)) -* Remove pip install statements ([#1546](https://github.com/googleapis/nodejs-vision/issues/1546)) ([#1040](https://github.com/googleapis/nodejs-vision/issues/1040)) ([85f115f](https://github.com/googleapis/nodejs-vision/commit/85f115f31f9b26c64e7b2704e6f908b88673db86)) - - -### Build System - -* Update library to use Node 12 ([#1016](https://github.com/googleapis/nodejs-vision/issues/1016)) ([12bd0f6](https://github.com/googleapis/nodejs-vision/commit/12bd0f66db6c497eb8e2d8a8236dca95432043b8)) - -### [2.4.2](https://www.github.com/googleapis/nodejs-vision/compare/v2.4.1...v2.4.2) (2022-01-06) - - -### Bug Fixes - -* add types to package.json ([#977](https://www.github.com/googleapis/nodejs-vision/issues/977)) ([1cd056b](https://www.github.com/googleapis/nodejs-vision/commit/1cd056b97c851eac1726610c85193ddc85cbddb7)) - -### [2.4.1](https://www.github.com/googleapis/nodejs-vision/compare/v2.4.0...v2.4.1) (2021-12-14) - - -### Bug Fixes - -* comment about gcsUri ([#967](https://www.github.com/googleapis/nodejs-vision/issues/967)) ([abc4044](https://www.github.com/googleapis/nodejs-vision/commit/abc4044dc972746292dad107009bc67223b88f86)) -* **deps:** update dependency redis to v4 ([#966](https://www.github.com/googleapis/nodejs-vision/issues/966)) ([1584e4e](https://www.github.com/googleapis/nodejs-vision/commit/1584e4e65f56f66a968472f6b7dabf23393dc3f4)) - -## [2.4.0](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.8...v2.4.0) (2021-09-09) - - -### Features - -* turns on self-signed JWT feature flag ([#942](https://www.github.com/googleapis/nodejs-vision/issues/942)) ([c0558c7](https://www.github.com/googleapis/nodejs-vision/commit/c0558c7ec2097c713cf591ae985eb5c8f7f7435a)) - - -### Bug Fixes - -* **build:** migrate to using main branch ([#947](https://www.github.com/googleapis/nodejs-vision/issues/947)) ([f1ce40f](https://www.github.com/googleapis/nodejs-vision/commit/f1ce40fcf255a052442d2fdd46516182a58b0aed)) - -### [2.3.8](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.7...v2.3.8) (2021-08-17) - - -### Bug Fixes - -* **deps:** google-gax v2.24.1 ([#939](https://www.github.com/googleapis/nodejs-vision/issues/939)) ([21d59e3](https://www.github.com/googleapis/nodejs-vision/commit/21d59e39ba66eb14db467e101477cba692a67d44)) - -### [2.3.7](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.6...v2.3.7) (2021-07-21) - - -### Bug Fixes - -* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#928](https://www.github.com/googleapis/nodejs-vision/issues/928)) ([f5cddc5](https://www.github.com/googleapis/nodejs-vision/commit/f5cddc5086a96ddc4255017366422df40a6efaf5)) - -### [2.3.6](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.5...v2.3.6) (2021-07-12) - - -### Bug Fixes - -* **deps:** google-gax v2.17.1 ([#926](https://www.github.com/googleapis/nodejs-vision/issues/926)) ([6853428](https://www.github.com/googleapis/nodejs-vision/commit/68534284ff975a3a1c950b6727358b77dac4fc83)) - -### [2.3.5](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.4...v2.3.5) (2021-06-29) - - -### Bug Fixes - -* **deps:** google-gax v2.17.0 with mTLS ([#923](https://www.github.com/googleapis/nodejs-vision/issues/923)) ([0292824](https://www.github.com/googleapis/nodejs-vision/commit/02928247cae0d8db0f4ced155e8f60c8d664cd17)) - -### [2.3.4](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.3...v2.3.4) (2021-06-22) - - -### Bug Fixes - -* make request optional in all cases ([#917](https://www.github.com/googleapis/nodejs-vision/issues/917)) ([d301b79](https://www.github.com/googleapis/nodejs-vision/commit/d301b79dee83948bada4b16e33048933d454c051)) - -### [2.3.3](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.2...v2.3.3) (2021-05-26) - - -### Bug Fixes - -* GoogleAdsError missing using generator version after 1.3.0 ([#908](https://www.github.com/googleapis/nodejs-vision/issues/908)) ([3bd4071](https://www.github.com/googleapis/nodejs-vision/commit/3bd4071597067b7f31d61cbaeaef1fc531179fc4)) - -### [2.3.2](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.1...v2.3.2) (2021-05-12) - - -### Bug Fixes - -* **deps:** require google-gax v2.12.0 ([#897](https://www.github.com/googleapis/nodejs-vision/issues/897)) ([bc987f4](https://www.github.com/googleapis/nodejs-vision/commit/bc987f4cc731de64792d5b56d4861038b310f211)) -* **deps:** update dependency natural to v5 ([#880](https://www.github.com/googleapis/nodejs-vision/issues/880)) ([6a82d95](https://www.github.com/googleapis/nodejs-vision/commit/6a82d95f532f054cd120920339c198d57ce2cf28)) -* use require() to load JSON protos ([#899](https://www.github.com/googleapis/nodejs-vision/issues/899)) ([01ff4e3](https://www.github.com/googleapis/nodejs-vision/commit/01ff4e3162541e4e255ca7b3e5478c2b754a78b9)) - -### [2.3.1](https://www.github.com/googleapis/nodejs-vision/compare/v2.3.0...v2.3.1) (2021-02-18) - - -### Bug Fixes - -* **deps:** update dependency natural to v3 ([#865](https://www.github.com/googleapis/nodejs-vision/issues/865)) ([38d9a1a](https://www.github.com/googleapis/nodejs-vision/commit/38d9a1a3ae9fe02b67135ecc3f56f6d3a53ac547)) -* **deps:** update dependency natural to v4 ([#870](https://www.github.com/googleapis/nodejs-vision/issues/870)) ([edfcb9e](https://www.github.com/googleapis/nodejs-vision/commit/edfcb9eed26145c1f72bfaaa3ee8e7a4d74630b3)) -* sync vision v1 protos to get extra FaceAnnotation Landmark Types ([#868](https://www.github.com/googleapis/nodejs-vision/issues/868)) ([4d45375](https://www.github.com/googleapis/nodejs-vision/commit/4d45375016aa12d0e8ea24525168e23590af47b4)) - -## [2.3.0](https://www.github.com/googleapis/nodejs-vision/compare/v2.2.0...v2.3.0) (2021-01-06) - - -### Features - -* introduce style enumeration ([b5fe1ac](https://www.github.com/googleapis/nodejs-vision/commit/b5fe1aca1ee70176c5569d1ff9255958988a0077)) - -## [2.2.0](https://www.github.com/googleapis/nodejs-vision/compare/v2.1.2...v2.2.0) (2021-01-06) - - -### Features - -* Add TextDetectionParams.enable_text_detection_confidence_score ([#850](https://www.github.com/googleapis/nodejs-vision/issues/850)) ([c8f51a2](https://www.github.com/googleapis/nodejs-vision/commit/c8f51a2fd03e0dc80c7a36c9e7602f2c1a94a73d)) - - -### Bug Fixes - -* **browser:** check for fetch on window ([ef95fb1](https://www.github.com/googleapis/nodejs-vision/commit/ef95fb1ff7f2495b2929c18b4c814ad93c8b42cc)) -* do not modify options object, use defaultScopes ([#845](https://www.github.com/googleapis/nodejs-vision/issues/845)) ([8377b42](https://www.github.com/googleapis/nodejs-vision/commit/8377b4268a4ed4ef07869c75c1ae48f4ec3b01ce)) - -### [2.1.2](https://www.github.com/googleapis/nodejs-vision/compare/v2.1.1...v2.1.2) (2020-09-12) - - -### Bug Fixes - -* **deps:** update dependency yargs to v16 ([#824](https://www.github.com/googleapis/nodejs-vision/issues/824)) ([9ce5215](https://www.github.com/googleapis/nodejs-vision/commit/9ce5215448b026adb10fa9c10156d4e8d8c865e4)) - -### [2.1.1](https://www.github.com/googleapis/nodejs-vision/compare/v2.1.0...v2.1.1) (2020-07-10) - - -### Bug Fixes - -* update node issue template ([#795](https://www.github.com/googleapis/nodejs-vision/issues/795)) ([e975833](https://www.github.com/googleapis/nodejs-vision/commit/e975833eb5b11d3c3834bfea9697a9611cae6a8f)) - -## [2.1.0](https://www.github.com/googleapis/nodejs-vision/compare/v2.0.0...v2.1.0) (2020-06-12) - - -### Features - -* **secrets:** begin migration to secret manager from keystore ([#790](https://www.github.com/googleapis/nodejs-vision/issues/790)) ([4d9e334](https://www.github.com/googleapis/nodejs-vision/commit/4d9e334bdf6bc479779541b31d26055199dcdbff)) -* switch to es2018 target for TypeScript ([#788](https://www.github.com/googleapis/nodejs-vision/issues/788)) ([7df91d4](https://www.github.com/googleapis/nodejs-vision/commit/7df91d4fc15f64aa9e462af45136ae5a361cc162)) - - -### Bug Fixes - -* handle fallback option properly ([#793](https://www.github.com/googleapis/nodejs-vision/issues/793)) ([43b45bf](https://www.github.com/googleapis/nodejs-vision/commit/43b45bf1b41976f0628cae227d7f7fab29359632)) - -## [2.0.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.11.0...v2.0.0) (2020-06-04) - - -### ⚠ BREAKING CHANGES - -* The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. - -### Features - -* check status of long running operation by its name ([#773](https://www.github.com/googleapis/nodejs-vision/issues/773)) ([2b3becf](https://www.github.com/googleapis/nodejs-vision/commit/2b3becf530294202d361d7a8f35601973332eafe)) -* drop node8 support, support for async iterators ([#568](https://www.github.com/googleapis/nodejs-vision/issues/568)) ([e2dccd0](https://www.github.com/googleapis/nodejs-vision/commit/e2dccd02d20ed82ed679fff629b5a4aab47b39b6)) - - -### Bug Fixes - -* **deps:** update dependency @google-cloud/promisify to v2 ([#565](https://www.github.com/googleapis/nodejs-vision/issues/565)) ([c71a709](https://www.github.com/googleapis/nodejs-vision/commit/c71a70926568367fa89fbbf4226e40fcb44f679e)) -* **deps:** update dependency mathjs to v7 ([#775](https://www.github.com/googleapis/nodejs-vision/issues/775)) ([d64d99f](https://www.github.com/googleapis/nodejs-vision/commit/d64d99fe615a7048a5537fbcb8fbf3364e1c53c0)) -* **deps:** update dependency natural to v1 ([#768](https://www.github.com/googleapis/nodejs-vision/issues/768)) ([44a8dcc](https://www.github.com/googleapis/nodejs-vision/commit/44a8dcc389489829f927015a1070e516f2e786b0)) -* **deps:** update dependency natural to v2 ([#772](https://www.github.com/googleapis/nodejs-vision/issues/772)) ([afdc8da](https://www.github.com/googleapis/nodejs-vision/commit/afdc8da5f4181b5d43c3dc0155294495d647645a)) -* **samples:** use pureimage instead of canvas ([#774](https://www.github.com/googleapis/nodejs-vision/issues/774)) ([a352338](https://www.github.com/googleapis/nodejs-vision/commit/a3523388bace85f19041202c74be4beb705d620d)) -* mocha tests ([#784](https://www.github.com/googleapis/nodejs-vision/issues/784)) ([319c98e](https://www.github.com/googleapis/nodejs-vision/commit/319c98e284a622876e055cfd7a249750d600ce76)) -* remove eslint, update gax, fix generated protos, run the generator ([#756](https://www.github.com/googleapis/nodejs-vision/issues/756)) ([72f22b6](https://www.github.com/googleapis/nodejs-vision/commit/72f22b60e1491963ea1d22a4f96feabe07be0376)) - -## [1.11.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.10.0...v1.11.0) (2020-03-11) - - -### Features - -* deferred client initialization ([#551](https://www.github.com/googleapis/nodejs-vision/issues/551)) ([8866d89](https://www.github.com/googleapis/nodejs-vision/commit/8866d8905750dfc0627f585c30c0b19bb205172d)) -* export protos from src/index.ts ([#547](https://www.github.com/googleapis/nodejs-vision/issues/547)) ([41c736c](https://www.github.com/googleapis/nodejs-vision/commit/41c736c8f234f6fba20120fa5c17353519f2d45d)) - -## [1.10.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.9.0...v1.10.0) (2020-03-03) - - -### Features - -* move API to typescript code generation ([#532](https://www.github.com/googleapis/nodejs-vision/issues/532)) ([401e694](https://www.github.com/googleapis/nodejs-vision/commit/401e6944796fd1249639da6b767e842576345c3e)) - -## [1.9.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.8.0...v1.9.0) (2020-02-10) - - -### Features - -* bump release level to GA ([#530](https://www.github.com/googleapis/nodejs-vision/issues/530)) ([3b091ba](https://www.github.com/googleapis/nodejs-vision/commit/3b091ba7c67864e845d1f399b8052684a2d6030e)) - - -### Bug Fixes - -* **deps:** update dependency redis to v3 ([#533](https://www.github.com/googleapis/nodejs-vision/issues/533)) ([d9b50cb](https://www.github.com/googleapis/nodejs-vision/commit/d9b50cb2ac56a5eadab72efed59f12189418993c)) - -## [1.8.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.7.2...v1.8.0) (2020-01-02) - - -### Features - -* add new resource descriptors ([#491](https://www.github.com/googleapis/nodejs-vision/issues/491)) ([95037bf](https://www.github.com/googleapis/nodejs-vision/commit/95037bf3c9236902ab31c23fd51a236e23100e91)) -* **samples:** add sample of configuring alternate apiEndpoint ([#473](https://www.github.com/googleapis/nodejs-vision/issues/473)) ([fa01482](https://www.github.com/googleapis/nodejs-vision/commit/fa01482648c93d7a57b5f7159a995a6b13e4f941)) - - -### Bug Fixes - -* **deps:** TypeScript 3.7.0 causes breaking change in typings ([#497](https://www.github.com/googleapis/nodejs-vision/issues/497)) ([30aa9ff](https://www.github.com/googleapis/nodejs-vision/commit/30aa9ffbdd3cdb8e28c300f7b9223f60fdb61d7e)) - -### [1.7.2](https://www.github.com/googleapis/nodejs-vision/compare/v1.7.1...v1.7.2) (2019-11-18) - - -### Bug Fixes - -* **deps:** update dependency yargs to v15 ([#488](https://www.github.com/googleapis/nodejs-vision/issues/488)) ([21c889e](https://www.github.com/googleapis/nodejs-vision/commit/21c889ee3157e38cc8eefec5da8f1d103fd41f17)) - -### [1.7.1](https://www.github.com/googleapis/nodejs-vision/compare/v1.7.0...v1.7.1) (2019-11-13) - - -### Bug Fixes - -* import long in proto ts declaration file ([#482](https://www.github.com/googleapis/nodejs-vision/issues/482)) ([1f5258b](https://www.github.com/googleapis/nodejs-vision/commit/1f5258b65665c4813463592af32720d07e5c8de4)) -* **docs:** snippets are now replaced in jsdoc comments ([#481](https://www.github.com/googleapis/nodejs-vision/issues/481)) ([07281d6](https://www.github.com/googleapis/nodejs-vision/commit/07281d6d0acbd59a9c308308cb090b598cda53a2)) - -## [1.7.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.6.0...v1.7.0) (2019-11-08) - - -### Features - -* add celebrity face detection ([#477](https://www.github.com/googleapis/nodejs-vision/issues/477)) ([cdfa59e](https://www.github.com/googleapis/nodejs-vision/commit/cdfa59e4156c5b557651c3bf50cfc46487149a7d)) - -## [1.6.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.5.0...v1.6.0) (2019-11-05) - - -### Features - -* added endpoint samples for vision api ([#467](https://www.github.com/googleapis/nodejs-vision/issues/467)) ([4c569b4](https://www.github.com/googleapis/nodejs-vision/commit/4c569b4ace83be63a12f85676c174a663796fa47)) - - -### Bug Fixes - -* **deps:** bump google-gax to 1.7.5 ([#464](https://www.github.com/googleapis/nodejs-vision/issues/464)) ([dcc4d62](https://www.github.com/googleapis/nodejs-vision/commit/dcc4d622f46922975d028af20aefc27446fdcad5)) - - -### Reverts - -* added endpoint samples for vision api ([ea5d421](https://www.github.com/googleapis/nodejs-vision/commit/ea5d4218816571556a2059fc977e2223678c979e)) - -## [1.5.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.4.0...v1.5.0) (2019-10-10) - - -### Bug Fixes - -* update protobuf options for product sets ([#462](https://www.github.com/googleapis/nodejs-vision/issues/462)) ([32b3fa9](https://www.github.com/googleapis/nodejs-vision/commit/32b3fa9)) -* use compatible version of google-gax ([a4f2863](https://www.github.com/googleapis/nodejs-vision/commit/a4f2863)) - - -### Features - -* .d.ts for protos ([#451](https://www.github.com/googleapis/nodejs-vision/issues/451)) ([15f4329](https://www.github.com/googleapis/nodejs-vision/commit/15f4329)) -* additional safe search confidence fields ([#444](https://www.github.com/googleapis/nodejs-vision/issues/444)) ([31735a7](https://www.github.com/googleapis/nodejs-vision/commit/31735a7)) - -## [1.4.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.3.0...v1.4.0) (2019-09-14) - - -### Features - -* make vision helpers work with JSON proto ([#441](https://www.github.com/googleapis/nodejs-vision/issues/441)) ([5b7a249](https://www.github.com/googleapis/nodejs-vision/commit/5b7a249)) - -## [1.3.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.2.0...v1.3.0) (2019-09-09) - - -### Bug Fixes - -* use process versions object for client header ([#428](https://www.github.com/googleapis/nodejs-vision/issues/428)) ([c1dde85](https://www.github.com/googleapis/nodejs-vision/commit/c1dde85)) -* **samples:** upgrade yargs and fix broken CLI config ([#436](https://www.github.com/googleapis/nodejs-vision/issues/436)) ([1a9c374](https://www.github.com/googleapis/nodejs-vision/commit/1a9c374)) - - -### Features - -* load protos from JSON, grpc-fallback support ([9914445](https://www.github.com/googleapis/nodejs-vision/commit/9914445)) - -## [1.2.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.1.4...v1.2.0) (2019-08-19) - - -### Features - -* adds support for multiple regions ([244e21e](https://www.github.com/googleapis/nodejs-vision/commit/244e21e)) - -### [1.1.4](https://www.github.com/googleapis/nodejs-vision/compare/v1.1.3...v1.1.4) (2019-08-05) - - -### Bug Fixes - -* allow calls with no request, add JSON proto ([55c0380](https://www.github.com/googleapis/nodejs-vision/commit/55c0380)) - -### [1.1.3](https://www.github.com/googleapis/nodejs-vision/compare/v1.1.2...v1.1.3) (2019-06-26) - - -### Bug Fixes - -* **docs:** link to reference docs section on googleapis.dev ([#406](https://www.github.com/googleapis/nodejs-vision/issues/406)) ([fa2fb3f](https://www.github.com/googleapis/nodejs-vision/commit/fa2fb3f)) - -### [1.1.2](https://www.github.com/googleapis/nodejs-vision/compare/v1.1.1...v1.1.2) (2019-06-15) - - -### Bug Fixes - -* **docs:** move to new client docs URL ([#401](https://www.github.com/googleapis/nodejs-vision/issues/401)) ([9b40044](https://www.github.com/googleapis/nodejs-vision/commit/9b40044)) - -### [1.1.1](https://www.github.com/googleapis/nodejs-vision/compare/v1.1.0...v1.1.1) (2019-06-11) - - -### Bug Fixes - -* **deps:** update dependency mathjs to v6 ([#399](https://www.github.com/googleapis/nodejs-vision/issues/399)) ([6c37196](https://www.github.com/googleapis/nodejs-vision/commit/6c37196)) - -## [1.1.0](https://www.github.com/googleapis/nodejs-vision/compare/v1.0.0...v1.1.0) (2019-06-05) - - -### Features - -* support apiEndpoint override in client constructor ([#393](https://www.github.com/googleapis/nodejs-vision/issues/393)) ([7777275](https://www.github.com/googleapis/nodejs-vision/commit/7777275)) - -## [1.0.0](https://www.github.com/googleapis/nodejs-vision/compare/v0.25.0...v1.0.0) (2019-05-13) - - -### Bug Fixes - -* **deps:** update dependency google-gax to v1 ([#376](https://www.github.com/googleapis/nodejs-vision/issues/376)) ([14a5ca9](https://www.github.com/googleapis/nodejs-vision/commit/14a5ca9)) -* DEADLINE_EXCEEDED is idempotent ([#377](https://www.github.com/googleapis/nodejs-vision/issues/377)) ([d7ed2d3](https://www.github.com/googleapis/nodejs-vision/commit/d7ed2d3)) -* **deps:** update dependency @google-cloud/promisify to v1 ([#367](https://www.github.com/googleapis/nodejs-vision/issues/367)) ([f1a5bcc](https://www.github.com/googleapis/nodejs-vision/commit/f1a5bcc)) -* **deps:** update dependency google-gax to ^0.26.0 ([#362](https://www.github.com/googleapis/nodejs-vision/issues/362)) ([81a3379](https://www.github.com/googleapis/nodejs-vision/commit/81a3379)) -* include 'x-goog-request-params' header in requests ([4e7a1c6](https://www.github.com/googleapis/nodejs-vision/commit/4e7a1c6)), closes [#353](https://www.github.com/googleapis/nodejs-vision/issues/353) -* **samples:** make test assertion less specific ([#354](https://www.github.com/googleapis/nodejs-vision/issues/354)) ([435ddf0](https://www.github.com/googleapis/nodejs-vision/commit/435ddf0)) - - -### Build System - -* upgrade engines field to >=8.10.0 ([#363](https://www.github.com/googleapis/nodejs-vision/issues/363)) ([e8a7141](https://www.github.com/googleapis/nodejs-vision/commit/e8a7141)) - - -### Features - -* image annotation batching ([#375](https://www.github.com/googleapis/nodejs-vision/issues/375)) ([bed2515](https://www.github.com/googleapis/nodejs-vision/commit/bed2515)) - - -### BREAKING CHANGES - -* upgrade engines field to >=8.10.0 (#363) - -## v0.25.0 - -02-22-2019 17:39 PST - -### New Features -This release contains a new version (v1p4beta1) of the Vision API. To use this version, construct the client liks this: - -```javascript -const vision = require('@google-cloud/vision'); -const client = new vision.v1p4beta1.ImageAnnotatorClient(); -``` - -- feat: gen v1p4beta1: online PDF, async batch image annotate ([#331](https://github.com/googleapis/nodejs-vision/pull/331)) - -### Implementation Changes -- fix: throw on invalid credentials in v1p4beta1 ([#334](https://github.com/googleapis/nodejs-vision/pull/334)) -- fix: throw on invalid credentials ([#326](https://github.com/googleapis/nodejs-vision/pull/326)) - -### Dependencies -- chore(deps): update dependency mocha to v6 ([#330](https://github.com/googleapis/nodejs-vision/pull/330)) -- fix(deps): update dependency @google-cloud/promisify to ^0.4.0 ([#328](https://github.com/googleapis/nodejs-vision/pull/328)) -- fix(deps): update dependency yargs to v13 ([#325](https://github.com/googleapis/nodejs-vision/pull/325)) -- fix(deps): update dependency google-gax to ^0.25.0 ([#315](https://github.com/googleapis/nodejs-vision/pull/315)) -- fix(deps): update dependency google-gax to ^0.24.0 ([#312](https://github.com/googleapis/nodejs-vision/pull/312)) -- chore(deps): update dependency eslint-config-prettier to v4 ([#313](https://github.com/googleapis/nodejs-vision/pull/313)) -- fix(deps): update dependency google-gax to ^0.23.0 ([#307](https://github.com/googleapis/nodejs-vision/pull/307)) - -### Documentation / Samples -- docs: update contributing path in README ([#321](https://github.com/googleapis/nodejs-vision/pull/321)) -- docs: update links in contrib guide ([#329](https://github.com/googleapis/nodejs-vision/pull/329)) -- docs: add lint/fix example to contributing guide ([#318](https://github.com/googleapis/nodejs-vision/pull/318)) -- docs: fix example comments ([#317](https://github.com/googleapis/nodejs-vision/pull/317)) -- fix(docs): remove unused long running operations types -- docs: improve detect.js samples ([#300](https://github.com/googleapis/nodejs-vision/pull/300)) - -### Internal / Testing Changes -- build: use linkinator for docs test ([#327](https://github.com/googleapis/nodejs-vision/pull/327)) -- build: create docs test npm scripts ([#324](https://github.com/googleapis/nodejs-vision/pull/324)) -- build: test using @grpc/grpc-js in CI ([#322](https://github.com/googleapis/nodejs-vision/pull/322)) -- chore: move CONTRIBUTING.md to root ([#320](https://github.com/googleapis/nodejs-vision/pull/320)) -- refactor: improve generated code style. ([#316](https://github.com/googleapis/nodejs-vision/pull/316)) -- fix: ignore case in system test assertions ([#314](https://github.com/googleapis/nodejs-vision/pull/314)) -- build: ignore googleapis.com in doc link check ([#310](https://github.com/googleapis/nodejs-vision/pull/310)) -- chore: update year in the license headers. ([#309](https://github.com/googleapis/nodejs-vision/pull/309)) -- build: check broken links in generated docs ([#301](https://github.com/googleapis/nodejs-vision/pull/301)) - -## v0.24.0 - -12-19-2018 13:36 PST - -### Implementation Changes -**This release contains breaking change** -- BREAKING: rename method imagePath => referenceImagePath ([#296](https://github.com/googleapis/nodejs-vision/pull/296)) -The method `ProductSearchClient.imagePath` was renamed `referenceImagePath`: -``` -// old code -const formattedName = client.imagePath(...); - -// new code -const formattedName = client.referenceImagePath(...); -``` -- fix: Param "scoreThreshold" should be "score_threshold" ([#234](https://github.com/googleapis/nodejs-vision/pull/234)) - -### New Features -- ProductSearch GA ([#280](https://github.com/googleapis/nodejs-vision/pull/280)) - -### Dependencies -- refactor: remove unused deps ([#261](https://github.com/googleapis/nodejs-vision/pull/261)) -- fix(deps): update dependency google-gax to ^0.22.0 ([#265](https://github.com/googleapis/nodejs-vision/pull/265)) -- chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 ([#263](https://github.com/googleapis/nodejs-vision/pull/263)) -- fix(deps): update dependency @google-cloud/vision to ^0.23.0 ([#260](https://github.com/googleapis/nodejs-vision/pull/260)) - -### Documentation -- docs: fix productSearch example ([#285](https://github.com/googleapis/nodejs-vision/pull/285)) -- docs: update readme badges ([#283](https://github.com/googleapis/nodejs-vision/pull/283)) -- docs(samples): updated samples code to use async/await and tests to use mocha ([#241](https://github.com/googleapis/nodejs-vision/pull/241)) - -### Internal / Testing Changes -- chore: modernize the samples and sample tests ([#297](https://github.com/googleapis/nodejs-vision/pull/297)) -- chore(build): inject yoshi automation key ([#294](https://github.com/googleapis/nodejs-vision/pull/294)) -- chore: update nyc and eslint configs ([#293](https://github.com/googleapis/nodejs-vision/pull/293)) -- chore: fix publish.sh permission +x ([#292](https://github.com/googleapis/nodejs-vision/pull/292)) -- fix(build): fix Kokoro release script ([#291](https://github.com/googleapis/nodejs-vision/pull/291)) -- build: add Kokoro configs for autorelease ([#290](https://github.com/googleapis/nodejs-vision/pull/290)) -- chore: always nyc report before calling codecov ([#288](https://github.com/googleapis/nodejs-vision/pull/288)) -- chore: nyc ignore build/test by default ([#287](https://github.com/googleapis/nodejs-vision/pull/287)) -- chore: update license file ([#284](https://github.com/googleapis/nodejs-vision/pull/284)) -- fix(build): fix system key decryption ([#282](https://github.com/googleapis/nodejs-vision/pull/282)) -- test: make product search tests run ([#269](https://github.com/googleapis/nodejs-vision/pull/269)) -- chore: update eslintignore config ([#264](https://github.com/googleapis/nodejs-vision/pull/264)) -- chore: drop contributors from multiple places ([#262](https://github.com/googleapis/nodejs-vision/pull/262)) - -## v0.23.0 - -### New Features -- feat: add support for product search - -### Dependencies -- chore(deps): update dependency eslint-plugin-node to v8 ([#245](https://github.com/googleapis/nodejs-vision/pull/245)) -- chore(deps): update dependency canvas to v2 ([#224](https://github.com/googleapis/nodejs-vision/pull/224)) -- chore(deps): update dependency sinon to v7 ([#219](https://github.com/googleapis/nodejs-vision/pull/219)) -- chore(deps): update dependency eslint-plugin-prettier to v3 ([#213](https://github.com/googleapis/nodejs-vision/pull/213)) - -### Documentation -- fix(samples): Adding vision_product_search_tutorial_import tags ([#221](https://github.com/googleapis/nodejs-vision/pull/221)) -- fix(samples): Change the Project ID from number to string ([#220](https://github.com/googleapis/nodejs-vision/pull/220)) -- docs: Vision AutoML samples ([#197](https://github.com/googleapis/nodejs-vision/pull/197)) - -### Internal / Testing Changes -- chore: use latest npm on Windows ([#258](https://github.com/googleapis/nodejs-vision/pull/258)) -- chore: update lint configs ([#257](https://github.com/googleapis/nodejs-vision/pull/257)) -- chore: update CircleCI config ([#253](https://github.com/googleapis/nodejs-vision/pull/253)) -- chore: update issue templates ([#244](https://github.com/googleapis/nodejs-vision/pull/244)) -- chore: remove old issue template ([#242](https://github.com/googleapis/nodejs-vision/pull/242)) -- build: run tests on node11 ([#239](https://github.com/googleapis/nodejs-vision/pull/239)) -- chores(build): do not collect sponge.xml from windows builds ([#238](https://github.com/googleapis/nodejs-vision/pull/238)) -- chores(build): run codecov on continuous builds ([#237](https://github.com/googleapis/nodejs-vision/pull/237)) -- chore: update new issue template ([#235](https://github.com/googleapis/nodejs-vision/pull/235)) -- build: fix codecov uploading on Kokoro ([#222](https://github.com/googleapis/nodejs-vision/pull/222)) -- chore: enable --throw-deprecation on mocha config ([#147](https://github.com/googleapis/nodejs-vision/pull/147)) -- Update kokoro config ([#214](https://github.com/googleapis/nodejs-vision/pull/214)) -- Update kokoro config ([#208](https://github.com/googleapis/nodejs-vision/pull/208)) -- test: remove appveyor config ([#207](https://github.com/googleapis/nodejs-vision/pull/207)) -- Update the CI config ([#206](https://github.com/googleapis/nodejs-vision/pull/206)) - -## v0.22.1 - -### Bug fixes -- Fix response output for Detect Labels ([#199](https://github.com/googleapis/nodejs-vision/pull/199)) - -### Documentation -- Vision GA – vision_localize_objects & vision_localize_object_gcs ([#200](https://github.com/googleapis/nodejs-vision/pull/200)) -- Product search rebased ([#196](https://github.com/googleapis/nodejs-vision/pull/196)) - -### Internal / Testing Changes -- Enable prefer-const in the eslint config ([#201](https://github.com/googleapis/nodejs-vision/pull/201)) -- Enable no-var in eslint ([#198](https://github.com/googleapis/nodejs-vision/pull/198)) -- Switch to let/const ([#194](https://github.com/googleapis/nodejs-vision/pull/194)) -- fix(deps): update dependency google-gax to ^0.20.0 ([#193](https://github.com/googleapis/nodejs-vision/pull/193)) - -## v0.22.0 - -### New Features -Object Localization is available on v1 of this library: -- Updated CI config and run synth ([#181](https://github.com/googleapis/nodejs-vision/pull/181)) - -### Dependencies -- chore(deps): update dependency @google-cloud/storage to v2 ([#183](https://github.com/googleapis/nodejs-vision/pull/183)) -- chore(deps): update dependency nyc to v13 ([#177](https://github.com/googleapis/nodejs-vision/pull/177)) -- fix(deps): update dependency google-gax to ^0.19.0 ([#173](https://github.com/googleapis/nodejs-vision/pull/173)) -- chore(deps): update dependency eslint-config-prettier to v3 ([#170](https://github.com/googleapis/nodejs-vision/pull/170)) - -### Internal / Testing Changes -- Update CI config ([#188](https://github.com/googleapis/nodejs-vision/pull/188)) -- Fix the sample tests ([#187](https://github.com/googleapis/nodejs-vision/pull/187)) -- Retry npm install in CI ([#185](https://github.com/googleapis/nodejs-vision/pull/185)) -- Update CI config ([#184](https://github.com/googleapis/nodejs-vision/pull/184)) -- fix: (tests): Use real service to validate expectations. ([#182](https://github.com/googleapis/nodejs-vision/pull/182)) -- chore: make the CircleCI config consistent -- Udpate Beta Vision samples to use beta tags ([#172](https://github.com/googleapis/nodejs-vision/pull/172)) -- Vision region tag update ([#171](https://github.com/googleapis/nodejs-vision/pull/171)) -- build: configure Windows build on Kokoro ([#165](https://github.com/googleapis/nodejs-vision/pull/165)) -- chore: do not use npm ci ([#167](https://github.com/googleapis/nodejs-vision/pull/167)) -- build(kokoro): samples-test.sh need GCLOUD_PROJECT env; node6 and node8 is using wrong .sh ([#162](https://github.com/googleapis/nodejs-vision/pull/162)) -- build(kokoro): setup samples and system test ([#161](https://github.com/googleapis/nodejs-vision/pull/161)) -- chore: ignore package-lock.json ([#160](https://github.com/googleapis/nodejs-vision/pull/160)) -- build: rename build.sh => test.sh; presubmit jobs runs lint and docs properly ([#158](https://github.com/googleapis/nodejs-vision/pull/158)) -- fix(samples): missing fs requires causing sample-test to fail ([#157](https://github.com/googleapis/nodejs-vision/pull/157)) -- build: add set -x to .sh to show the command being executed ([#156](https://github.com/googleapis/nodejs-vision/pull/156)) -- add samples linking to kokoro jobs ([#155](https://github.com/googleapis/nodejs-vision/pull/155)) -- Kokoro multi ver ([#153](https://github.com/googleapis/nodejs-vision/pull/153)) -- chore: update renovate config ([#152](https://github.com/googleapis/nodejs-vision/pull/152)) -- have presubmit.cfg in separate node* folders ([#151](https://github.com/googleapis/nodejs-vision/pull/151)) -- split presubmit to multiple node versions ([#149](https://github.com/googleapis/nodejs-vision/pull/149)) - -## v0.21.1 - -Patch release to bring in updates to google-gax@0.18.0 so it no longer emits deprecation warnings with grpc (#120), along with other dependency updates and documentation changes. - -### Dependencies -- fix(deps): update dependency google-gax to ^0.18.0 (#146) -- chore: drop dependency on common (#134) -- chore(deps): update dependency eslint-plugin-node to v7 (#127) - -### Documentation -- Code Samples demonstrating Object Localization & Handwriting OCR (#133) - -### Internal / Testing Changes -- build: initial kokoro setup (#145) -- chore: assert.deelEqual => assert.deepStrictEqual (#143) -- chore: move mocha options to mocha.opts (#141) -- chore: require node 8 for samples (#142) -- chore: add node templates to synth.py (#139) -- fix(deps): update dependency @google-cloud/vision to ^0.21.0 (#131) - -## v0.21.0 - -### Implementation Changes -#### 🚨 BREAKING CHANGE -In this version we dropped support for NodeJS 4.x and 9.x. Your code might break if you're using this library on non LTS versions. -- fix: drop support for node.js 4.x and 9.x (#117) - -### New Features -This release brings in v1p3beta1 of the Cloud Vision API, which includes the following new features: -- Object localization -- Product search - -- gen: v1p3beta1 of Cloud Vision API NodeJS Client Library (#124) -- feat: implement manual methods for objectLocalization and productSearch on v1p3beta1 (#128) - -### Dependencies -- fix: update and cleanup dependencies (#102) -- fix(deps): update dependency yargs to v12 (#103) -- repo: setup greenkeeper.json to update dependencies in samples/package.json (#94) -- refactor: drop dependency on extend (#85) -- fix: move async to dev dependencies (#83) -- chore: update many dependencies (#81) -- fix: switch from node-uuid to uuid (#84) -- chore(package): update eslint to version 5.0.1 (#98) -- chore(package): update eslint to version 5.0.0 (#90) - -### Documentation - -### Internal / Testing Changes -- Add smoke tests via regeneration (#122) -- Re-generate library using /synth.py (#111) -- synth.py: follow synth scripts from other repos (#113) -- Beta2ga pdf ocr (#104) -- Configure Renovate (#87) -- refactor: drop repo-tool as an exec wrapper (#97) -- fix: update linking for samples (#92) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 2add2547..46b2a08e 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,94 +1,43 @@ - -# Code of Conduct +# Contributor Code of Conduct -## Our Pledge +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of -experience, education, socio-economic status, nationality, personal appearance, -race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, or to ban temporarily or permanently any -contributor for other behaviors that they deem inappropriate, threatening, -offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -This Code of Conduct also applies outside the project spaces when the Project -Steward has a reasonable belief that an individual's behavior may have a -negative impact on the project or its community. - -## Conflict Resolution - -We do not believe that all conflict is bad; healthy debate and disagreement -often yield positive results. However, it is never okay to be disrespectful or -to engage in behavior that violates the project’s code of conduct. - -If you see someone violating the code of conduct, you are encouraged to address -the behavior directly with those involved. Many issues can be resolved quickly -and easily, and this gives people more control over the outcome of their -dispute. If you are unable to resolve the matter for any reason, or if the -behavior is threatening or harassing, report it. We are dedicated to providing -an environment where participants feel welcome and safe. - -Reports should be directed to *googleapis-stewards@google.com*, the -Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to -receive and address reported violations of the code of conduct. They will then -work with a committee consisting of representatives from the Open Source -Programs Office and the Google Open Source Strategy team. If for any reason you -are uncomfortable reaching out to the Project Steward, please email -opensource@google.com. - -We will investigate every complaint, but you may not receive a direct response. -We will use our discretion in determining when and how to follow up on reported -incidents, which may range from not taking action to permanent expulsion from -the project and project-sponsored spaces. We will notify the accused of the -report and provide them an opportunity to discuss it before any action is taken. -The identity of the reporter will be omitted from the details of the report -supplied to the accused. In potentially harmful situations, such as ongoing -harassment or threats to anyone's safety, we may take action without notice. - -## Attribution - -This Code of Conduct is adapted from the Contributor Covenant, version 1.4, -available at -https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 006b5bab..78aaa61b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,18 +34,8 @@ accept your pull requests. 1. Ensure that your code adheres to the existing style in the code to which you are contributing. 1. Ensure that your code has an appropriate set of tests which all pass. -1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling. 1. Submit a pull request. -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Google Cloud Vision API API][enable_api]. -1. [Set up authentication with a service account][auth] so you can access the - API from your local workstation. - - ## Running the tests 1. [Prepare your environment for Node.js setup][setup]. @@ -56,21 +46,10 @@ accept your pull requests. 1. Run the tests: - # Run unit tests. npm test - # Run sample integration tests. - npm run samples-test - - # Run all system tests. - npm run system-test - 1. Lint (and maybe fix) any changes: npm run fix [setup]: https://cloud.google.com/nodejs/docs/setup -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=vision.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/README.md b/README.md index ee51af61..66d3db6a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -**_THIS REPOSITORY IS DEPRECATED. ALL OF ITS CONTENT AND HISTORY HAS BEEN MOVED TO [GOOGLE-CLOUD-NODE](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-vision)_** - [//]: # "This README.md file is auto-generated, all changes to this file will be lost." [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo diff --git a/linkinator.config.json b/linkinator.config.json deleted file mode 100644 index befd23c8..00000000 --- a/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owlbot.py b/owlbot.py deleted file mode 100644 index 49fce7a6..00000000 --- a/owlbot.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the License); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import synthtool.languages.node as node -node.owlbot_main(templates_excludes=[ -'README.md' -]) diff --git a/package.json b/package.json deleted file mode 100644 index fd6e3187..00000000 --- a/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@google-cloud/vision", - "description": "Google Cloud Vision API client for Node.js", - "version": "3.1.0", - "license": "Apache-2.0", - "author": "Google Inc", - "engines": { - "node": ">=12.0.0" - }, - "repository": "googleapis/nodejs-vision", - "main": "build/src/index.js", - "types": "build/src/index.d.ts", - "files": [ - "build/protos", - "build/src" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google vision", - "vision", - "Google Cloud Vision API" - ], - "scripts": { - "test": "c8 mocha build/test", - "samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../", - "lint": "gts check", - "docs": "jsdoc -c .jsdoc.js", - "system-test": "mocha build/system-test --timeout 20000", - "fix": "gts fix", - "test-no-cover": "mocha test/*.js", - "docs-test": "linkinator docs", - "predocs-test": "npm run docs", - "prelint": "cd samples; npm link ../; npm install", - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "prepare": "npm run compile", - "precompile": "gts clean" - }, - "dependencies": { - "@google-cloud/promisify": "^3.0.0", - "google-gax": "^3.5.2", - "is": "^3.3.0" - }, - "devDependencies": { - "@google-cloud/storage": "^6.0.0", - "@types/is": "0.0.21", - "@types/mocha": "^10.0.0", - "@types/node": "^18.0.0", - "@types/sinon": "^10.0.0", - "@types/uuid": "^9.0.0", - "c8": "^7.1.0", - "codecov": "^3.6.5", - "gts": "^4.0.0", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.0", - "jsdoc-region-tag": "^2.0.0", - "linkinator": "^4.0.0", - "mocha": "^10.0.0", - "null-loader": "^4.0.0", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.0", - "ts-loader": "^9.0.0", - "typescript": "^4.6.4", - "uuid": "^9.0.0", - "webpack": "^5.0.0", - "webpack-cli": "^5.0.0" - } -} diff --git a/protos/google/cloud/common_resources.proto b/protos/google/cloud/common_resources.proto deleted file mode 100644 index 56c9f800..00000000 --- a/protos/google/cloud/common_resources.proto +++ /dev/null @@ -1,52 +0,0 @@ -// 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/protos/google/cloud/vision/v1/geometry.proto b/protos/google/cloud/vision/v1/geometry.proto deleted file mode 100644 index 7e0d24c2..00000000 --- a/protos/google/cloud/vision/v1/geometry.proto +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; -option java_multiple_files = true; -option java_outer_classname = "GeometryProto"; -option java_package = "com.google.cloud.vision.v1"; -option objc_class_prefix = "GCVN"; - -// A vertex represents a 2D point in the image. -// NOTE: the vertex coordinates are in the same scale as the original image. -message Vertex { - // X coordinate. - int32 x = 1; - - // Y coordinate. - int32 y = 2; -} - -// 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. -message NormalizedVertex { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; -} - -// A bounding polygon for the detected image annotation. -message BoundingPoly { - // The bounding polygon vertices. - repeated Vertex vertices = 1; - - // The bounding polygon normalized vertices. - repeated NormalizedVertex normalized_vertices = 2; -} - -// 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. -message Position { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; - - // Z coordinate (or depth). - float z = 3; -} diff --git a/protos/google/cloud/vision/v1/image_annotator.proto b/protos/google/cloud/vision/v1/image_annotator.proto deleted file mode 100644 index 6fed6112..00000000 --- a/protos/google/cloud/vision/v1/image_annotator.proto +++ /dev/null @@ -1,1044 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/vision/v1/geometry.proto"; -import "google/cloud/vision/v1/product_search.proto"; -import "google/cloud/vision/v1/text_annotation.proto"; -import "google/cloud/vision/v1/web_detection.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/color.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ImageAnnotatorProto"; -option java_package = "com.google.cloud.vision.v1"; -option objc_class_prefix = "GCVN"; - -// 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 ImageAnnotator { - option (google.api.default_host) = "vision.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-vision"; - - // Run image detection and annotation for a batch of images. - rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) { - option (google.api.http) = { - post: "/v1/images:annotate" - body: "*" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/images:annotate" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*}/images:annotate" - body: "*" - } - }; - option (google.api.method_signature) = "requests"; - } - - // 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. - rpc BatchAnnotateFiles(BatchAnnotateFilesRequest) returns (BatchAnnotateFilesResponse) { - option (google.api.http) = { - post: "/v1/files:annotate" - body: "*" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/files:annotate" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*}/files:annotate" - body: "*" - } - }; - option (google.api.method_signature) = "requests"; - } - - // 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. - rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/images:asyncBatchAnnotate" - body: "*" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/images:asyncBatchAnnotate" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*}/images:asyncBatchAnnotate" - body: "*" - } - }; - option (google.api.method_signature) = "requests,output_config"; - option (google.longrunning.operation_info) = { - response_type: "AsyncBatchAnnotateImagesResponse" - metadata_type: "OperationMetadata" - }; - } - - // 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). - rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/files:asyncBatchAnnotate" - body: "*" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*}/files:asyncBatchAnnotate" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*}/files:asyncBatchAnnotate" - body: "*" - } - }; - option (google.api.method_signature) = "requests"; - option (google.longrunning.operation_info) = { - response_type: "AsyncBatchAnnotateFilesResponse" - metadata_type: "OperationMetadata" - }; - } -} - -// A bucketized representation of likelihood, which is intended to give clients -// highly stable results across model upgrades. -enum 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; -} - -// 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. -message Feature { - // Type of Google Cloud Vision API feature to be extracted. - enum 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; - } - - // The feature type. - Type type = 1; - - // Maximum number of results of this type. Does not apply to - // `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - int32 max_results = 2; - - // Model to use for the feature. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also - // support "builtin/weekly" for the bleeding edge release updated weekly. - string model = 3; -} - -// External image source (Google Cloud Storage or web URL image location). -message ImageSource { - // **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. - string gcs_image_uri = 1; - - // 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. - string image_uri = 2; -} - -// Client image to perform Google Cloud Vision API tasks over. -message Image { - // 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. - // - // Currently, this field only works for BatchAnnotateImages requests. It does - // not work for AsyncBatchAnnotateImages requests. - bytes content = 1; - - // 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. - ImageSource source = 2; -} - -// A face annotation object contains the results of face detection. -message FaceAnnotation { - // A face-specific landmark (for example, a face feature). - message Landmark { - // 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 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; - - // Left cheek center. - LEFT_CHEEK_CENTER = 35; - - // Right cheek center. - RIGHT_CHEEK_CENTER = 36; - } - - // Face landmark type. - Type type = 3; - - // Face landmark position. - Position position = 4; - } - - // 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. - BoundingPoly bounding_poly = 1; - - // 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. - BoundingPoly fd_bounding_poly = 2; - - // Detected face landmarks. - repeated Landmark landmarks = 3; - - // 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]. - float roll_angle = 4; - - // 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]. - float pan_angle = 5; - - // Pitch angle, which indicates the upwards/downwards angle that the face is - // pointing relative to the image's horizontal plane. Range [-180,180]. - float tilt_angle = 6; - - // Detection confidence. Range [0, 1]. - float detection_confidence = 7; - - // Face landmarking confidence. Range [0, 1]. - float landmarking_confidence = 8; - - // Joy likelihood. - Likelihood joy_likelihood = 9; - - // Sorrow likelihood. - Likelihood sorrow_likelihood = 10; - - // Anger likelihood. - Likelihood anger_likelihood = 11; - - // Surprise likelihood. - Likelihood surprise_likelihood = 12; - - // Under-exposed likelihood. - Likelihood under_exposed_likelihood = 13; - - // Blurred likelihood. - Likelihood blurred_likelihood = 14; - - // Headwear likelihood. - Likelihood headwear_likelihood = 15; -} - -// Detected entity location information. -message LocationInfo { - // lat/long location coordinates. - google.type.LatLng lat_lng = 1; -} - -// A `Property` consists of a user-supplied name/value pair. -message Property { - // Name of the property. - string name = 1; - - // Value of the property. - string value = 2; - - // Value of numeric properties. - uint64 uint64_value = 3; -} - -// Set of detected entity features. -message EntityAnnotation { - // Opaque entity ID. Some IDs may be available in - // [Google Knowledge Graph Search - // API](https://developers.google.com/knowledge-graph/). - string mid = 1; - - // The language code for the locale in which the entity textual - // `description` is expressed. - string locale = 2; - - // Entity textual description, expressed in its `locale` language. - string description = 3; - - // Overall score of the result. Range [0, 1]. - float score = 4; - - // **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]. - float confidence = 5 [deprecated = true]; - - // 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]. - float topicality = 6; - - // Image region to which this entity belongs. Not produced - // for `LABEL_DETECTION` features. - BoundingPoly bounding_poly = 7; - - // 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. - repeated LocationInfo locations = 8; - - // Some entities may have optional user-supplied `Property` (name/value) - // fields, such a score or string that qualifies the entity. - repeated Property properties = 9; -} - -// Set of detected objects with bounding boxes. -message LocalizedObjectAnnotation { - // Object ID that should align with EntityAnnotation mid. - string mid = 1; - - // 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. - string language_code = 2; - - // Object name, expressed in its `language_code` language. - string name = 3; - - // Score of the result. Range [0, 1]. - float score = 4; - - // Image region to which this object belongs. This must be populated. - BoundingPoly bounding_poly = 5; -} - -// Set of features pertaining to the image, computed by computer vision -// methods over safe-search verticals (for example, adult, spoof, medical, -// violence). -message SafeSearchAnnotation { - // Represents the adult content likelihood for the image. Adult content may - // contain elements such as nudity, pornographic images or cartoons, or - // sexual activities. - Likelihood adult = 1; - - // Spoof likelihood. The likelihood that an modification - // was made to the image's canonical version to make it appear - // funny or offensive. - Likelihood spoof = 2; - - // Likelihood that this is a medical image. - Likelihood medical = 3; - - // Likelihood that this image contains violent content. - Likelihood violence = 4; - - // 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. - Likelihood racy = 9; -} - -// Rectangle determined by min and max `LatLng` pairs. -message LatLongRect { - // Min lat/long pair. - google.type.LatLng min_lat_lng = 1; - - // Max lat/long pair. - google.type.LatLng max_lat_lng = 2; -} - -// Color information consists of RGB channels, score, and the fraction of -// the image that the color occupies in the image. -message ColorInfo { - // RGB components of the color. - google.type.Color color = 1; - - // Image-specific score for this color. Value in range [0, 1]. - float score = 2; - - // The fraction of pixels the color occupies in the image. - // Value in range [0, 1]. - float pixel_fraction = 3; -} - -// Set of dominant colors and their corresponding scores. -message DominantColorsAnnotation { - // RGB color values with their score and pixel fraction. - repeated ColorInfo colors = 1; -} - -// Stores image properties, such as dominant colors. -message ImageProperties { - // If present, dominant colors completed successfully. - DominantColorsAnnotation dominant_colors = 1; -} - -// Single crop hint that is used to generate a new crop when serving an image. -message CropHint { - // The bounding polygon for the crop region. The coordinates of the bounding - // box are in the original image's scale. - BoundingPoly bounding_poly = 1; - - // Confidence of this being a salient region. Range [0, 1]. - float confidence = 2; - - // Fraction of importance of this salient region with respect to the original - // image. - float importance_fraction = 3; -} - -// Set of crop hints that are used to generate new crops when serving images. -message CropHintsAnnotation { - // Crop hint results. - repeated CropHint crop_hints = 1; -} - -// Parameters for crop hints annotation request. -message CropHintsParams { - // 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. - repeated float aspect_ratios = 1; -} - -// Parameters for web detection request. -message WebDetectionParams { - // Whether to include results derived from the geo information in the image. - bool include_geo_results = 2; -} - -// Parameters for text detections. This is used to control TEXT_DETECTION and -// DOCUMENT_TEXT_DETECTION features. -message TextDetectionParams { - // By default, Cloud Vision API only includes confidence score for - // DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence - // score for TEXT_DETECTION as well. - bool enable_text_detection_confidence_score = 9; - - // A list of advanced OCR options to fine-tune OCR behavior. - repeated string advanced_ocr_options = 11; -} - -// Image context and/or feature-specific parameters. -message ImageContext { - // Not used. - LatLongRect lat_long_rect = 1; - - // 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). - repeated string language_hints = 2; - - // Parameters for crop hints annotation request. - CropHintsParams crop_hints_params = 4; - - // Parameters for product search. - ProductSearchParams product_search_params = 5; - - // Parameters for web detection. - WebDetectionParams web_detection_params = 6; - - // Parameters for text detection and document text detection. - TextDetectionParams text_detection_params = 12; -} - -// Request for performing Google Cloud Vision API tasks over a user-provided -// image, with user-requested features, and with context information. -message AnnotateImageRequest { - // The image to be processed. - Image image = 1; - - // Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image. - ImageContext image_context = 3; -} - -// If an image was produced from a file (e.g. a PDF), this message gives -// information about the source of that image. -message ImageAnnotationContext { - // The URI of the file used to produce the image. - string uri = 1; - - // If the file was a PDF or TIFF, this field gives the page number within - // the file used to produce the image. - int32 page_number = 2; -} - -// Response to an image annotation request. -message AnnotateImageResponse { - // If present, face detection has completed successfully. - repeated FaceAnnotation face_annotations = 1; - - // If present, landmark detection has completed successfully. - repeated EntityAnnotation landmark_annotations = 2; - - // If present, logo detection has completed successfully. - repeated EntityAnnotation logo_annotations = 3; - - // If present, label detection has completed successfully. - repeated EntityAnnotation label_annotations = 4; - - // If present, localized object detection has completed successfully. - // This will be sorted descending by confidence score. - repeated LocalizedObjectAnnotation localized_object_annotations = 22; - - // If present, text (OCR) detection has completed successfully. - repeated EntityAnnotation text_annotations = 5; - - // If present, text (OCR) detection or document (OCR) text detection has - // completed successfully. - // This annotation provides the structural hierarchy for the OCR detected - // text. - TextAnnotation full_text_annotation = 12; - - // If present, safe-search annotation has completed successfully. - SafeSearchAnnotation safe_search_annotation = 6; - - // If present, image properties were extracted successfully. - ImageProperties image_properties_annotation = 8; - - // If present, crop hints have completed successfully. - CropHintsAnnotation crop_hints_annotation = 11; - - // If present, web detection has completed successfully. - WebDetection web_detection = 13; - - // If present, product search has completed successfully. - ProductSearchResults product_search_results = 14; - - // 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. - google.rpc.Status error = 9; - - // If present, contextual information is needed to understand where this image - // comes from. - ImageAnnotationContext context = 21; -} - -// Multiple image annotation requests are batched into a single service call. -message BatchAnnotateImagesRequest { - // Required. Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - string parent = 4; -} - -// Response to a batch image annotation request. -message BatchAnnotateImagesResponse { - // Individual responses to image annotation requests within the batch. - repeated AnnotateImageResponse responses = 1; -} - -// A request to annotate one single file, e.g. a PDF, TIFF or GIF file. -message AnnotateFileRequest { - // Required. Information about the input file. - InputConfig input_config = 1; - - // Required. Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image(s) in the file. - ImageContext image_context = 3; - - // 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. - repeated int32 pages = 4; -} - -// Response to a single file annotation request. A file may contain one or more -// images, which individually have their own responses. -message AnnotateFileResponse { - // Information about the file for which this response is generated. - InputConfig input_config = 1; - - // Individual responses to images found within the file. This field will be - // empty if the `error` field is set. - repeated AnnotateImageResponse responses = 2; - - // This field gives the total number of pages in the file. - int32 total_pages = 3; - - // If set, represents the error message for the failed request. The - // `responses` field will not be set in this case. - google.rpc.Status error = 4; -} - -// A list of requests to annotate files using the BatchAnnotateFiles API. -message BatchAnnotateFilesRequest { - // Required. The list of file annotation requests. Right now we support only one - // AnnotateFileRequest in BatchAnnotateFilesRequest. - repeated AnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - string parent = 3; -} - -// A list of file annotation responses. -message BatchAnnotateFilesResponse { - // The list of file annotation responses, each response corresponding to each - // AnnotateFileRequest in BatchAnnotateFilesRequest. - repeated AnnotateFileResponse responses = 1; -} - -// An offline file annotation request. -message AsyncAnnotateFileRequest { - // Required. Information about the input file. - InputConfig input_config = 1; - - // Required. Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image(s) in the file. - ImageContext image_context = 3; - - // Required. The desired output location and metadata (e.g. format). - OutputConfig output_config = 4; -} - -// The response for a single offline file annotation request. -message AsyncAnnotateFileResponse { - // The output location and metadata from AsyncAnnotateFileRequest. - OutputConfig output_config = 1; -} - -// Request for async image annotation for a list of images. -message AsyncBatchAnnotateImagesRequest { - // Required. Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The desired output location and metadata (e.g. format). - OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - string parent = 4; -} - -// Response to an async batch image annotation request. -message AsyncBatchAnnotateImagesResponse { - // The output location and metadata from AsyncBatchAnnotateImagesRequest. - OutputConfig output_config = 1; -} - -// Multiple async file annotation requests are batched into a single service -// call. -message AsyncBatchAnnotateFilesRequest { - // Required. Individual async file annotation requests for this batch. - repeated AsyncAnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - string parent = 4; -} - -// Response to an async batch file annotation request. -message AsyncBatchAnnotateFilesResponse { - // The list of file annotation responses, one for each request in - // AsyncBatchAnnotateFilesRequest. - repeated AsyncAnnotateFileResponse responses = 1; -} - -// The desired input location and metadata. -message InputConfig { - // The Google Cloud Storage location to read the input from. - GcsSource gcs_source = 1; - - // 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. - bytes content = 3; - - // The type of the file. Currently only "application/pdf", "image/tiff" and - // "image/gif" are supported. Wildcards are not supported. - string mime_type = 2; -} - -// The desired output location and metadata. -message OutputConfig { - // The Google Cloud Storage location to write the output(s) to. - GcsDestination gcs_destination = 1; - - // 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. - int32 batch_size = 2; -} - -// The Google Cloud Storage location where the input will be read from. -message GcsSource { - // Google Cloud Storage URI for the input file. This must only be a - // Google Cloud Storage object. Wildcards are not currently supported. - string uri = 1; -} - -// The Google Cloud Storage location where the output will be written to. -message GcsDestination { - // 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. - string uri = 1; -} - -// Contains metadata for the BatchAnnotateImages operation. -message OperationMetadata { - // Batch operation states. - enum 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; - } - - // Current state of the batch operation. - State state = 1; - - // The time when the batch request was received. - google.protobuf.Timestamp create_time = 5; - - // The time when the operation result was last updated. - google.protobuf.Timestamp update_time = 6; -} diff --git a/protos/google/cloud/vision/v1/product_search.proto b/protos/google/cloud/vision/v1/product_search.proto deleted file mode 100644 index a2a98505..00000000 --- a/protos/google/cloud/vision/v1/product_search.proto +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1; - -import "google/api/resource.proto"; -import "google/cloud/vision/v1/geometry.proto"; -import "google/cloud/vision/v1/product_search_service.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ProductSearchProto"; -option java_package = "com.google.cloud.vision.v1"; -option objc_class_prefix = "GCVN"; - -// Parameters for a product search request. -message ProductSearchParams { - // The bounding polygon around the area of interest in the image. - // If it is not specified, system discretion will be applied. - BoundingPoly bounding_poly = 9; - - // The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - string product_set = 6 [(google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - }]; - - // 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. - repeated string product_categories = 7; - - // 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 '='. - string filter = 8; -} - -// Results for a product search request. -message ProductSearchResults { - // Information about a product. - message Result { - // The Product. - Product product = 1; - - // A confidence level on the match, ranging from 0 (no confidence) to - // 1 (full confidence). - float score = 2; - - // The resource name of the image from the product that is the closest match - // to the query. - string image = 3; - } - - // Prediction for what the object in the bounding box is. - message ObjectAnnotation { - // Object ID that should align with EntityAnnotation mid. - string mid = 1; - - // 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. - string language_code = 2; - - // Object name, expressed in its `language_code` language. - string name = 3; - - // Score of the result. Range [0, 1]. - float score = 4; - } - - // Information about the products similar to a single product in a query - // image. - message GroupedResult { - // The bounding polygon around the product detected in the query image. - BoundingPoly bounding_poly = 1; - - // List of results, one for each product match. - repeated Result results = 2; - - // List of generic predictions for the object in the bounding box. - repeated ObjectAnnotation object_annotations = 3; - } - - // 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. - google.protobuf.Timestamp index_time = 2; - - // List of results, one for each product match. - repeated Result results = 5; - - // 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. - repeated GroupedResult product_grouped_results = 6; -} diff --git a/protos/google/cloud/vision/v1/product_search_service.proto b/protos/google/cloud/vision/v1/product_search_service.proto deleted file mode 100644 index 65680d90..00000000 --- a/protos/google/cloud/vision/v1/product_search_service.proto +++ /dev/null @@ -1,1022 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/vision/v1/geometry.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ProductSearchServiceProto"; -option java_package = "com.google.cloud.vision.v1"; -option objc_class_prefix = "GCVN"; - -// 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/*` -service ProductSearch { - option (google.api.default_host) = "vision.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-vision"; - - // Creates and returns a new ProductSet resource. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if display_name is missing, or is longer than - // 4096 characters. - rpc CreateProductSet(CreateProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/productSets" - body: "product_set" - }; - option (google.api.method_signature) = "parent,product_set,product_set_id"; - } - - // Lists ProductSets in an unspecified order. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if page_size is greater than 100, or less - // than 1. - rpc ListProductSets(ListProductSetsRequest) returns (ListProductSetsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/productSets" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a ProductSet. - // - // Possible errors: - // - // * Returns NOT_FOUND if the ProductSet does not exist. - rpc GetProductSet(GetProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/productSets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc UpdateProductSet(UpdateProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - patch: "/v1/{product_set.name=projects/*/locations/*/productSets/*}" - body: "product_set" - }; - option (google.api.method_signature) = "product_set,update_mask"; - } - - // Permanently deletes a ProductSet. Products and ReferenceImages in the - // ProductSet are not deleted. - // - // The actual image files are not deleted from Google Cloud Storage. - rpc DeleteProductSet(DeleteProductSetRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/productSets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc CreateProduct(CreateProductRequest) returns (Product) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/products" - body: "product" - }; - option (google.api.method_signature) = "parent,product,product_id"; - } - - // Lists products in an unspecified order. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/products" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a Product. - // - // Possible errors: - // - // * Returns NOT_FOUND if the Product does not exist. - rpc GetProduct(GetProductRequest) returns (Product) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/products/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc UpdateProduct(UpdateProductRequest) returns (Product) { - option (google.api.http) = { - patch: "/v1/{product.name=projects/*/locations/*/products/*}" - body: "product" - }; - option (google.api.method_signature) = "product,update_mask"; - } - - // 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. - rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/products/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc CreateReferenceImage(CreateReferenceImageRequest) returns (ReferenceImage) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/products/*}/referenceImages" - body: "reference_image" - }; - option (google.api.method_signature) = "parent,reference_image,reference_image_id"; - } - - // 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. - rpc DeleteReferenceImage(DeleteReferenceImageRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/products/*/referenceImages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc ListReferenceImages(ListReferenceImagesRequest) returns (ListReferenceImagesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/products/*}/referenceImages" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a ReferenceImage. - // - // Possible errors: - // - // * Returns NOT_FOUND if the specified image does not exist. - rpc GetReferenceImage(GetReferenceImageRequest) returns (ReferenceImage) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/products/*/referenceImages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc AddProductToProductSet(AddProductToProductSetRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/productSets/*}:addProduct" - body: "*" - }; - option (google.api.method_signature) = "name,product"; - } - - // Removes a Product from the specified ProductSet. - rpc RemoveProductFromProductSet(RemoveProductFromProductSetRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/productSets/*}:removeProduct" - body: "*" - }; - option (google.api.method_signature) = "name,product"; - } - - // 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. - rpc ListProductsInProductSet(ListProductsInProductSetRequest) returns (ListProductsInProductSetResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/productSets/*}/products" - }; - option (google.api.method_signature) = "name"; - } - - // 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]. - rpc ImportProductSets(ImportProductSetsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/productSets:import" - body: "*" - }; - option (google.api.method_signature) = "parent,input_config"; - option (google.longrunning.operation_info) = { - response_type: "ImportProductSetsResponse" - metadata_type: "BatchOperationMetadata" - }; - } - - // 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) - rpc PurgeProducts(PurgeProductsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/products:purge" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "BatchOperationMetadata" - }; - } -} - -// A Product contains ReferenceImages. -message Product { - option (google.api.resource) = { - type: "vision.googleapis.com/Product" - pattern: "projects/{project}/locations/{location}/products/{product}" - }; - - // A product label represented as a key-value pair. - message KeyValue { - // The key of the label attached to the product. Cannot be empty and cannot - // exceed 128 bytes. - string key = 1; - - // The value of the label attached to the product. Cannot be empty and - // cannot exceed 128 bytes. - string value = 2; - } - - // 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. - string name = 1; - - // The user-provided name for this Product. Must not be empty. Must be at most - // 4096 characters long. - string display_name = 2; - - // User-provided metadata to be stored with this product. Must be at most 4096 - // characters long. - string description = 3; - - // Immutable. The category for the product identified by the reference image. This should - // be one of "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1" or - // "general-v1". The legacy categories "homegoods", "apparel", and "toys" are - // still supported, but these should not be used for new products. - string product_category = 4 [(google.api.field_behavior) = IMMUTABLE]; - - // 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. - repeated KeyValue product_labels = 5; -} - -// A ProductSet contains Products. A ProductSet can contain a maximum of 1 -// million reference images. If the limit is exceeded, periodic indexing will -// fail. -message ProductSet { - option (google.api.resource) = { - type: "vision.googleapis.com/ProductSet" - pattern: "projects/{project}/locations/{location}/productSets/{product_set}" - }; - - // 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. - string name = 1; - - // The user-provided name for this ProductSet. Must not be empty. Must be at - // most 4096 characters long. - string display_name = 2; - - // 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. - google.protobuf.Timestamp index_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If there was an error with indexing the product set, the field - // is populated. - // - // This field is ignored when creating a ProductSet. - google.rpc.Status index_error = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A `ReferenceImage` represents a product image and its associated metadata, -// such as bounding boxes. -message ReferenceImage { - option (google.api.resource) = { - type: "vision.googleapis.com/ReferenceImage" - pattern: "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}" - }; - - // 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. - string name = 1; - - // Required. The Google Cloud Storage URI of the reference image. - // - // The URI must start with `gs://`. - string uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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). - repeated BoundingPoly bounding_polys = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for the `CreateProduct` method. -message CreateProductRequest { - // Required. The project in which the Product should be created. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The product to create. - Product product = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string product_id = 3; -} - -// Request message for the `ListProducts` method. -message ListProductsRequest { - // Required. The project OR ProductSet from which Products should be listed. - // - // Format: - // `projects/PROJECT_ID/locations/LOC_ID` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProducts` method. -message ListProductsResponse { - // List of products. - repeated Product products = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for the `GetProduct` method. -message GetProductRequest { - // Required. Resource name of the Product to get. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; -} - -// Request message for the `UpdateProduct` method. -message UpdateProductRequest { - // Required. The Product resource which replaces the one on the server. - // product.name is immutable. - Product product = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for the `DeleteProduct` method. -message DeleteProductRequest { - // Required. Resource name of product to delete. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; -} - -// Request message for the `CreateProductSet` method. -message CreateProductSetRequest { - // Required. The project in which the ProductSet should be created. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The ProductSet to create. - ProductSet product_set = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string product_set_id = 3; -} - -// Request message for the `ListProductSets` method. -message ListProductSetsRequest { - // Required. The project from which ProductSets should be listed. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProductSets` method. -message ListProductSetsResponse { - // List of ProductSets. - repeated ProductSet product_sets = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for the `GetProductSet` method. -message GetProductSetRequest { - // Required. Resource name of the ProductSet to get. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; -} - -// Request message for the `UpdateProductSet` method. -message UpdateProductSetRequest { - // Required. The ProductSet resource which replaces the one on the server. - ProductSet product_set = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for the `DeleteProductSet` method. -message DeleteProductSetRequest { - // Required. Resource name of the ProductSet to delete. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; -} - -// Request message for the `CreateReferenceImage` method. -message CreateReferenceImageRequest { - // Required. Resource name of the product in which to create the reference image. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; - - // Required. The reference image to create. - // If an image ID is specified, it is ignored. - ReferenceImage reference_image = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string reference_image_id = 3; -} - -// Request message for the `ListReferenceImages` method. -message ListReferenceImagesRequest { - // Required. Resource name of the product containing the reference images. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // 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. - string page_token = 3; -} - -// Response message for the `ListReferenceImages` method. -message ListReferenceImagesResponse { - // The list of reference images. - repeated ReferenceImage reference_images = 1; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string next_page_token = 3; -} - -// Request message for the `GetReferenceImage` method. -message GetReferenceImageRequest { - // Required. The resource name of the ReferenceImage to get. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ReferenceImage" - } - ]; -} - -// Request message for the `DeleteReferenceImage` method. -message DeleteReferenceImageRequest { - // Required. The resource name of the reference image to delete. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ReferenceImage" - } - ]; -} - -// Request message for the `AddProductToProductSet` method. -message AddProductToProductSetRequest { - // Required. The resource name for the ProductSet to modify. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // Required. The resource name for the Product to be added to this ProductSet. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string product = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; -} - -// Request message for the `RemoveProductFromProductSet` method. -message RemoveProductFromProductSetRequest { - // Required. The resource name for the ProductSet to modify. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // Required. The resource name for the Product to be removed from this ProductSet. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string product = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; -} - -// Request message for the `ListProductsInProductSet` method. -message ListProductsInProductSetRequest { - // Required. The ProductSet resource for which to retrieve Products. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProductsInProductSet` method. -message ListProductsInProductSetResponse { - // The list of Products. - repeated Product products = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// The Google Cloud Storage location for a csv file which preserves a list of -// ImportProductSetRequests in each line. -message ImportProductSetsGcsSource { - // 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][google.cloud.vision.v1.Product.display_name], the - // `product-category` column refers to - // [product_category][google.cloud.vision.v1.Product.product_category], and the - // `labels` column refers to [product_labels][google.cloud.vision.v1.Product.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][google.cloud.vision.v1.Product.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). - string csv_file_uri = 1; -} - -// The input content for the `ImportProductSets` method. -message ImportProductSetsInputConfig { - // The source of the input. - oneof source { - // The Google Cloud Storage location for a csv file which preserves a list - // of ImportProductSetRequests in each line. - ImportProductSetsGcsSource gcs_source = 1; - } -} - -// Request message for the `ImportProductSets` method. -message ImportProductSetsRequest { - // Required. The project in which the ProductSets should be imported. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The input content for the list of requests. - ImportProductSetsInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for the `ImportProductSets` method. -// -// This message is returned by the -// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned -// [google.longrunning.Operation.response][google.longrunning.Operation.response] field. -message ImportProductSetsResponse { - // The list of reference_images that are imported successfully. - repeated ReferenceImage reference_images = 1; - - // 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. - repeated google.rpc.Status statuses = 2; -} - -// 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. -message BatchOperationMetadata { - // Enumerates the possible states that the batch request can be in. - enum 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; - } - - // The current state of the batch operation. - State state = 1; - - // The time when the batch request was submitted to the server. - google.protobuf.Timestamp submit_time = 2; - - // The time when the batch request is finished and - // [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. - google.protobuf.Timestamp end_time = 3; -} - -// Config to control which ProductSet contains the Products to be deleted. -message ProductSetPurgeConfig { - // 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. - string product_set_id = 1; -} - -// Request message for the `PurgeProducts` method. -message PurgeProductsRequest { - // The Products to delete. - oneof target { - // Specify which ProductSet contains the Products to be deleted. - ProductSetPurgeConfig product_set_purge_config = 2; - - // If delete_orphan_products is true, all Products that are not in any - // ProductSet will be deleted. - bool delete_orphan_products = 3; - } - - // Required. The project and location in which the Products should be deleted. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The default value is false. Override this value to true to actually perform - // the purge. - bool force = 4; -} diff --git a/protos/google/cloud/vision/v1/text_annotation.proto b/protos/google/cloud/vision/v1/text_annotation.proto deleted file mode 100644 index 9c07c322..00000000 --- a/protos/google/cloud/vision/v1/text_annotation.proto +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1; - -import "google/cloud/vision/v1/geometry.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; -option java_multiple_files = true; -option java_outer_classname = "TextAnnotationProto"; -option java_package = "com.google.cloud.vision.v1"; -option objc_class_prefix = "GCVN"; - -// 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][google.cloud.vision.v1.TextAnnotation.TextProperty] message definition below for more -// detail. -message TextAnnotation { - // Detected language for a structural component. - message DetectedLanguage { - // The BCP-47 language code, such as "en-US" or "sr-Latn". For more - // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - string language_code = 1; - - // Confidence of detected language. Range [0, 1]. - float confidence = 2; - } - - // Detected start or end of a structural component. - message DetectedBreak { - // Enum to denote the type of break found. New line, space etc. - enum 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; - } - - // Detected break type. - BreakType type = 1; - - // True if break prepends the element. - bool is_prefix = 2; - } - - // Additional information detected on the structural component. - message TextProperty { - // A list of detected languages together with confidence. - repeated DetectedLanguage detected_languages = 1; - - // Detected start or end of a text segment. - DetectedBreak detected_break = 2; - } - - // List of pages detected by OCR. - repeated Page pages = 1; - - // UTF-8 text detected on the pages. - string text = 2; -} - -// Detected page from OCR. -message Page { - // Additional information detected on the page. - TextAnnotation.TextProperty property = 1; - - // Page width. For PDFs the unit is points. For images (including - // TIFFs) the unit is pixels. - int32 width = 2; - - // Page height. For PDFs the unit is points. For images (including - // TIFFs) the unit is pixels. - int32 height = 3; - - // List of blocks of text, images etc on this page. - repeated Block blocks = 4; - - // Confidence of the OCR results on the page. Range [0, 1]. - float confidence = 5; -} - -// Logical element on the page. -message Block { - // Type of a block (text, image etc) as identified by OCR. - enum 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; - } - - // Additional information detected for the block. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of paragraphs in this block (if this blocks is of type text). - repeated Paragraph paragraphs = 3; - - // Detected block type (text, image etc) for this block. - BlockType block_type = 4; - - // Confidence of the OCR results on the block. Range [0, 1]. - float confidence = 5; -} - -// Structural unit of text representing a number of words in certain order. -message Paragraph { - // Additional information detected for the paragraph. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of all words in this paragraph. - repeated Word words = 3; - - // Confidence of the OCR results for the paragraph. Range [0, 1]. - float confidence = 4; -} - -// A word representation. -message Word { - // Additional information detected for the word. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of symbols in the word. - // The order of the symbols follows the natural reading order. - repeated Symbol symbols = 3; - - // Confidence of the OCR results for the word. Range [0, 1]. - float confidence = 4; -} - -// A single symbol representation. -message Symbol { - // Additional information detected for the symbol. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // The actual UTF-8 representation of the symbol. - string text = 3; - - // Confidence of the OCR results for the symbol. Range [0, 1]. - float confidence = 4; -} diff --git a/protos/google/cloud/vision/v1/web_detection.proto b/protos/google/cloud/vision/v1/web_detection.proto deleted file mode 100644 index 369a1350..00000000 --- a/protos/google/cloud/vision/v1/web_detection.proto +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision"; -option java_multiple_files = true; -option java_outer_classname = "WebDetectionProto"; -option java_package = "com.google.cloud.vision.v1"; -option objc_class_prefix = "GCVN"; - -// Relevant information for the image from the Internet. -message WebDetection { - // Entity deduced from similar images on the Internet. - message WebEntity { - // Opaque entity ID. - string entity_id = 1; - - // Overall relevancy score for the entity. - // Not normalized and not comparable across different image queries. - float score = 2; - - // Canonical description of the entity, in English. - string description = 3; - } - - // Metadata for online images. - message WebImage { - // The result image URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the image. - float score = 2; - } - - // Metadata for web pages. - message WebPage { - // The result web page URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the web page. - float score = 2; - - // Title for the web page, may contain HTML markups. - string page_title = 3; - - // Fully matching images on the page. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 4; - - // 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. - repeated WebImage partial_matching_images = 5; - } - - // Label to provide extra metadata for the web detection. - message WebLabel { - // Label for extra metadata. - string label = 1; - - // 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. - string language_code = 2; - } - - // Deduced entities from similar images on the Internet. - repeated WebEntity web_entities = 1; - - // Fully matching images from the Internet. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 2; - - // 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. - repeated WebImage partial_matching_images = 3; - - // Web pages containing the matching images from the Internet. - repeated WebPage pages_with_matching_images = 4; - - // The visually similar image results. - repeated WebImage visually_similar_images = 6; - - // The service's best guess as to the topic of the request image. - // Inferred from similar images on the open web. - repeated WebLabel best_guess_labels = 8; -} diff --git a/protos/google/cloud/vision/v1p1beta1/geometry.proto b/protos/google/cloud/vision/v1p1beta1/geometry.proto deleted file mode 100644 index 6d46d9c3..00000000 --- a/protos/google/cloud/vision/v1p1beta1/geometry.proto +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p1beta1; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "GeometryProto"; -option java_package = "com.google.cloud.vision.v1p1beta1"; - -// A vertex represents a 2D point in the image. -// NOTE: the vertex coordinates are in the same scale as the original image. -message Vertex { - // X coordinate. - int32 x = 1; - - // Y coordinate. - int32 y = 2; -} - -// A bounding polygon for the detected image annotation. -message BoundingPoly { - // The bounding polygon vertices. - repeated Vertex vertices = 1; -} - -// 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. -message Position { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; - - // Z coordinate (or depth). - float z = 3; -} diff --git a/protos/google/cloud/vision/v1p1beta1/image_annotator.proto b/protos/google/cloud/vision/v1p1beta1/image_annotator.proto deleted file mode 100644 index f66ad504..00000000 --- a/protos/google/cloud/vision/v1p1beta1/image_annotator.proto +++ /dev/null @@ -1,618 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/vision/v1p1beta1/geometry.proto"; -import "google/cloud/vision/v1p1beta1/text_annotation.proto"; -import "google/cloud/vision/v1p1beta1/web_detection.proto"; -import "google/rpc/status.proto"; -import "google/type/color.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ImageAnnotatorProto"; -option java_package = "com.google.cloud.vision.v1p1beta1"; - -// 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 ImageAnnotator { - option (google.api.default_host) = "vision.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-vision"; - - // Run image detection and annotation for a batch of images. - rpc BatchAnnotateImages(BatchAnnotateImagesRequest) - returns (BatchAnnotateImagesResponse) { - option (google.api.http) = { - post: "/v1p1beta1/images:annotate" - body: "*" - }; - option (google.api.method_signature) = "requests"; - } -} - -// 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. -message Feature { - // Type of image feature. - enum 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; - } - - // The feature type. - Type type = 1; - - // Maximum number of results of this type. - int32 max_results = 2; - - // Model to use for the feature. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also - // support "builtin/weekly" for the bleeding edge release updated weekly. - string model = 3; -} - -// External image source (Google Cloud Storage image location). -message ImageSource { - // 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. - string gcs_image_uri = 1; - - // 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. - string image_uri = 2; -} - -// Client image to perform Google Cloud Vision API tasks over. -message Image { - // 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. - bytes content = 1; - - // 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. - ImageSource source = 2; -} - -// A face annotation object contains the results of face detection. -message FaceAnnotation { - // A face-specific landmark (for example, a face feature). - message Landmark { - // 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 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; - } - - // Face landmark type. - Type type = 3; - - // Face landmark position. - Position position = 4; - } - - // 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. - BoundingPoly bounding_poly = 1; - - // 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. - BoundingPoly fd_bounding_poly = 2; - - // Detected face landmarks. - repeated Landmark landmarks = 3; - - // 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]. - float roll_angle = 4; - - // 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]. - float pan_angle = 5; - - // Pitch angle, which indicates the upwards/downwards angle that the face is - // pointing relative to the image's horizontal plane. Range [-180,180]. - float tilt_angle = 6; - - // Detection confidence. Range [0, 1]. - float detection_confidence = 7; - - // Face landmarking confidence. Range [0, 1]. - float landmarking_confidence = 8; - - // Joy likelihood. - Likelihood joy_likelihood = 9; - - // Sorrow likelihood. - Likelihood sorrow_likelihood = 10; - - // Anger likelihood. - Likelihood anger_likelihood = 11; - - // Surprise likelihood. - Likelihood surprise_likelihood = 12; - - // Under-exposed likelihood. - Likelihood under_exposed_likelihood = 13; - - // Blurred likelihood. - Likelihood blurred_likelihood = 14; - - // Headwear likelihood. - Likelihood headwear_likelihood = 15; -} - -// Detected entity location information. -message LocationInfo { - // lat/long location coordinates. - google.type.LatLng lat_lng = 1; -} - -// A `Property` consists of a user-supplied name/value pair. -message Property { - // Name of the property. - string name = 1; - - // Value of the property. - string value = 2; - - // Value of numeric properties. - uint64 uint64_value = 3; -} - -// Set of detected entity features. -message EntityAnnotation { - // Opaque entity ID. Some IDs may be available in - // [Google Knowledge Graph Search - // API](https://developers.google.com/knowledge-graph/). - string mid = 1; - - // The language code for the locale in which the entity textual - // `description` is expressed. - string locale = 2; - - // Entity textual description, expressed in its `locale` language. - string description = 3; - - // Overall score of the result. Range [0, 1]. - float score = 4; - - // 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]. - float confidence = 5; - - // 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]. - float topicality = 6; - - // Image region to which this entity belongs. Not produced - // for `LABEL_DETECTION` features. - BoundingPoly bounding_poly = 7; - - // 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. - repeated LocationInfo locations = 8; - - // Some entities may have optional user-supplied `Property` (name/value) - // fields, such a score or string that qualifies the entity. - repeated Property properties = 9; -} - -// Set of features pertaining to the image, computed by computer vision -// methods over safe-search verticals (for example, adult, spoof, medical, -// violence). -message SafeSearchAnnotation { - // Represents the adult content likelihood for the image. Adult content may - // contain elements such as nudity, pornographic images or cartoons, or - // sexual activities. - Likelihood adult = 1; - - // Spoof likelihood. The likelihood that an modification - // was made to the image's canonical version to make it appear - // funny or offensive. - Likelihood spoof = 2; - - // Likelihood that this is a medical image. - Likelihood medical = 3; - - // Likelihood that this image contains violent content. - Likelihood violence = 4; - - // 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. - Likelihood racy = 9; -} - -// Rectangle determined by min and max `LatLng` pairs. -message LatLongRect { - // Min lat/long pair. - google.type.LatLng min_lat_lng = 1; - - // Max lat/long pair. - google.type.LatLng max_lat_lng = 2; -} - -// Color information consists of RGB channels, score, and the fraction of -// the image that the color occupies in the image. -message ColorInfo { - // RGB components of the color. - google.type.Color color = 1; - - // Image-specific score for this color. Value in range [0, 1]. - float score = 2; - - // The fraction of pixels the color occupies in the image. - // Value in range [0, 1]. - float pixel_fraction = 3; -} - -// Set of dominant colors and their corresponding scores. -message DominantColorsAnnotation { - // RGB color values with their score and pixel fraction. - repeated ColorInfo colors = 1; -} - -// Stores image properties, such as dominant colors. -message ImageProperties { - // If present, dominant colors completed successfully. - DominantColorsAnnotation dominant_colors = 1; -} - -// Single crop hint that is used to generate a new crop when serving an image. -message CropHint { - // The bounding polygon for the crop region. The coordinates of the bounding - // box are in the original image's scale, as returned in `ImageParams`. - BoundingPoly bounding_poly = 1; - - // Confidence of this being a salient region. Range [0, 1]. - float confidence = 2; - - // Fraction of importance of this salient region with respect to the original - // image. - float importance_fraction = 3; -} - -// Set of crop hints that are used to generate new crops when serving images. -message CropHintsAnnotation { - // Crop hint results. - repeated CropHint crop_hints = 1; -} - -// Parameters for crop hints annotation request. -message CropHintsParams { - // 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. - repeated float aspect_ratios = 1; -} - -// Parameters for web detection request. -message WebDetectionParams { - // Whether to include results derived from the geo information in the image. - bool include_geo_results = 2; -} - -// Parameters for text detections. This is used to control TEXT_DETECTION and -// DOCUMENT_TEXT_DETECTION features. -message TextDetectionParams { - - // By default, Cloud Vision API only includes confidence score for - // DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence - // score for TEXT_DETECTION as well. - bool enable_text_detection_confidence_score = 9; - - // A list of advanced OCR options to fine-tune OCR behavior. - repeated string advanced_ocr_options = 11; -} - -// Image context and/or feature-specific parameters. -message ImageContext { - // lat/long rectangle that specifies the location of the image. - LatLongRect lat_long_rect = 1; - - // 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). - repeated string language_hints = 2; - - // Parameters for crop hints annotation request. - CropHintsParams crop_hints_params = 4; - - // Parameters for web detection. - WebDetectionParams web_detection_params = 6; - - // Parameters for text detection and document text detection. - TextDetectionParams text_detection_params = 12; -} - -// Request for performing Google Cloud Vision API tasks over a user-provided -// image, with user-requested features. -message AnnotateImageRequest { - // The image to be processed. - Image image = 1; - - // Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image. - ImageContext image_context = 3; -} - -// Response to an image annotation request. -message AnnotateImageResponse { - // If present, face detection has completed successfully. - repeated FaceAnnotation face_annotations = 1; - - // If present, landmark detection has completed successfully. - repeated EntityAnnotation landmark_annotations = 2; - - // If present, logo detection has completed successfully. - repeated EntityAnnotation logo_annotations = 3; - - // If present, label detection has completed successfully. - repeated EntityAnnotation label_annotations = 4; - - // If present, text (OCR) detection has completed successfully. - repeated EntityAnnotation text_annotations = 5; - - // If present, text (OCR) detection or document (OCR) text detection has - // completed successfully. - // This annotation provides the structural hierarchy for the OCR detected - // text. - TextAnnotation full_text_annotation = 12; - - // If present, safe-search annotation has completed successfully. - SafeSearchAnnotation safe_search_annotation = 6; - - // If present, image properties were extracted successfully. - ImageProperties image_properties_annotation = 8; - - // If present, crop hints have completed successfully. - CropHintsAnnotation crop_hints_annotation = 11; - - // If present, web detection has completed successfully. - WebDetection web_detection = 13; - - // 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. - google.rpc.Status error = 9; -} - -// Multiple image annotation requests are batched into a single service call. -message BatchAnnotateImagesRequest { - // Required. Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response to a batch image annotation request. -message BatchAnnotateImagesResponse { - // Individual responses to image annotation requests within the batch. - repeated AnnotateImageResponse responses = 1; -} - -// A bucketized representation of likelihood, which is intended to give clients -// highly stable results across model upgrades. -enum 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; -} diff --git a/protos/google/cloud/vision/v1p1beta1/text_annotation.proto b/protos/google/cloud/vision/v1p1beta1/text_annotation.proto deleted file mode 100644 index f85cc44d..00000000 --- a/protos/google/cloud/vision/v1p1beta1/text_annotation.proto +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p1beta1; - -import "google/cloud/vision/v1p1beta1/geometry.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "TextAnnotationProto"; -option java_package = "com.google.cloud.vision.v1p1beta1"; - -// 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][google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty] -// message definition below for more detail. -message TextAnnotation { - // Detected language for a structural component. - message DetectedLanguage { - // The BCP-47 language code, such as "en-US" or "sr-Latn". For more - // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - string language_code = 1; - - // Confidence of detected language. Range [0, 1]. - float confidence = 2; - } - - // Detected start or end of a structural component. - message DetectedBreak { - // Enum to denote the type of break found. New line, space etc. - enum 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; - } - - // Detected break type. - BreakType type = 1; - - // True if break prepends the element. - bool is_prefix = 2; - } - - // Additional information detected on the structural component. - message TextProperty { - // A list of detected languages together with confidence. - repeated DetectedLanguage detected_languages = 1; - - // Detected start or end of a text segment. - DetectedBreak detected_break = 2; - } - - // List of pages detected by OCR. - repeated Page pages = 1; - - // UTF-8 text detected on the pages. - string text = 2; -} - -// Detected page from OCR. -message Page { - // Additional information detected on the page. - TextAnnotation.TextProperty property = 1; - - // Page width in pixels. - int32 width = 2; - - // Page height in pixels. - int32 height = 3; - - // List of blocks of text, images etc on this page. - repeated Block blocks = 4; - - // Confidence of the OCR results on the page. Range [0, 1]. - float confidence = 5; -} - -// Logical element on the page. -message Block { - // Type of a block (text, image etc) as identified by OCR. - enum 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; - } - - // Additional information detected for the block. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of paragraphs in this block (if this blocks is of type text). - repeated Paragraph paragraphs = 3; - - // Detected block type (text, image etc) for this block. - BlockType block_type = 4; - - // Confidence of the OCR results on the block. Range [0, 1]. - float confidence = 5; -} - -// Structural unit of text representing a number of words in certain order. -message Paragraph { - // Additional information detected for the paragraph. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of words in this paragraph. - repeated Word words = 3; - - // Confidence of the OCR results for the paragraph. Range [0, 1]. - float confidence = 4; -} - -// A word representation. -message Word { - // Additional information detected for the word. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of symbols in the word. - // The order of the symbols follows the natural reading order. - repeated Symbol symbols = 3; - - // Confidence of the OCR results for the word. Range [0, 1]. - float confidence = 4; -} - -// A single symbol representation. -message Symbol { - // Additional information detected for the symbol. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // The actual UTF-8 representation of the symbol. - string text = 3; - - // Confidence of the OCR results for the symbol. Range [0, 1]. - float confidence = 4; -} diff --git a/protos/google/cloud/vision/v1p1beta1/web_detection.proto b/protos/google/cloud/vision/v1p1beta1/web_detection.proto deleted file mode 100644 index c50e1ad6..00000000 --- a/protos/google/cloud/vision/v1p1beta1/web_detection.proto +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p1beta1; - - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "WebDetectionProto"; -option java_package = "com.google.cloud.vision.v1p1beta1"; - -// Relevant information for the image from the Internet. -message WebDetection { - // Entity deduced from similar images on the Internet. - message WebEntity { - // Opaque entity ID. - string entity_id = 1; - - // Overall relevancy score for the entity. - // Not normalized and not comparable across different image queries. - float score = 2; - - // Canonical description of the entity, in English. - string description = 3; - } - - // Metadata for online images. - message WebImage { - // The result image URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the image. - float score = 2; - } - - // Metadata for web pages. - message WebPage { - // The result web page URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the web page. - float score = 2; - - // Title for the web page, may contain HTML markups. - string page_title = 3; - - // Fully matching images on the page. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 4; - - // 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. - repeated WebImage partial_matching_images = 5; - } - - // Label to provide extra metadata for the web detection. - message WebLabel { - // Label for extra metadata. - string label = 1; - - // 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. - string language_code = 2; - } - - // Deduced entities from similar images on the Internet. - repeated WebEntity web_entities = 1; - - // Fully matching images from the Internet. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 2; - - // 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. - repeated WebImage partial_matching_images = 3; - - // Web pages containing the matching images from the Internet. - repeated WebPage pages_with_matching_images = 4; - - // The visually similar image results. - repeated WebImage visually_similar_images = 6; - - // Best guess text labels for the request image. - repeated WebLabel best_guess_labels = 8; -} diff --git a/protos/google/cloud/vision/v1p2beta1/geometry.proto b/protos/google/cloud/vision/v1p2beta1/geometry.proto deleted file mode 100644 index e9fec20b..00000000 --- a/protos/google/cloud/vision/v1p2beta1/geometry.proto +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2018 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p2beta1; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "GeometryProto"; -option java_package = "com.google.cloud.vision.v1p2beta1"; - -// A vertex represents a 2D point in the image. -// NOTE: the vertex coordinates are in the same scale as the original image. -message Vertex { - // X coordinate. - int32 x = 1; - - // Y coordinate. - int32 y = 2; -} - -// 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. -message NormalizedVertex { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; -} - -// A bounding polygon for the detected image annotation. -message BoundingPoly { - // The bounding polygon vertices. - repeated Vertex vertices = 1; - - // The bounding polygon normalized vertices. - repeated NormalizedVertex normalized_vertices = 2; -} - -// 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. -message Position { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; - - // Z coordinate (or depth). - float z = 3; -} diff --git a/protos/google/cloud/vision/v1p2beta1/image_annotator.proto b/protos/google/cloud/vision/v1p2beta1/image_annotator.proto deleted file mode 100644 index 264462d4..00000000 --- a/protos/google/cloud/vision/v1p2beta1/image_annotator.proto +++ /dev/null @@ -1,794 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/vision/v1p2beta1/geometry.proto"; -import "google/cloud/vision/v1p2beta1/text_annotation.proto"; -import "google/cloud/vision/v1p2beta1/web_detection.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/color.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ImageAnnotatorProto"; -option java_package = "com.google.cloud.vision.v1p2beta1"; - -// 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 ImageAnnotator { - option (google.api.default_host) = "vision.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-vision"; - - // Run image detection and annotation for a batch of images. - rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) { - option (google.api.http) = { - post: "/v1p2beta1/images:annotate" - body: "*" - }; - option (google.api.method_signature) = "requests"; - } - - // 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). - rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p2beta1/files:asyncBatchAnnotate" - body: "*" - }; - option (google.api.method_signature) = "requests"; - option (google.longrunning.operation_info) = { - response_type: "AsyncBatchAnnotateFilesResponse" - metadata_type: "OperationMetadata" - }; - } -} - -// 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. -message Feature { - // Type of Google Cloud Vision API feature to be extracted. - enum 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; - } - - // The feature type. - Type type = 1; - - // Maximum number of results of this type. Does not apply to - // `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - int32 max_results = 2; - - // Model to use for the feature. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also - // support "builtin/weekly" for the bleeding edge release updated weekly. - string model = 3; -} - -// External image source (Google Cloud Storage or web URL image location). -message ImageSource { - // **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. - string gcs_image_uri = 1; - - // 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. - string image_uri = 2; -} - -// Client image to perform Google Cloud Vision API tasks over. -message Image { - // 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. - bytes content = 1; - - // 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. - ImageSource source = 2; -} - -// A face annotation object contains the results of face detection. -message FaceAnnotation { - // A face-specific landmark (for example, a face feature). - message Landmark { - // 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 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; - } - - // Face landmark type. - Type type = 3; - - // Face landmark position. - Position position = 4; - } - - // 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. - BoundingPoly bounding_poly = 1; - - // 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. - BoundingPoly fd_bounding_poly = 2; - - // Detected face landmarks. - repeated Landmark landmarks = 3; - - // 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]. - float roll_angle = 4; - - // 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]. - float pan_angle = 5; - - // Pitch angle, which indicates the upwards/downwards angle that the face is - // pointing relative to the image's horizontal plane. Range [-180,180]. - float tilt_angle = 6; - - // Detection confidence. Range [0, 1]. - float detection_confidence = 7; - - // Face landmarking confidence. Range [0, 1]. - float landmarking_confidence = 8; - - // Joy likelihood. - Likelihood joy_likelihood = 9; - - // Sorrow likelihood. - Likelihood sorrow_likelihood = 10; - - // Anger likelihood. - Likelihood anger_likelihood = 11; - - // Surprise likelihood. - Likelihood surprise_likelihood = 12; - - // Under-exposed likelihood. - Likelihood under_exposed_likelihood = 13; - - // Blurred likelihood. - Likelihood blurred_likelihood = 14; - - // Headwear likelihood. - Likelihood headwear_likelihood = 15; -} - -// Detected entity location information. -message LocationInfo { - // lat/long location coordinates. - google.type.LatLng lat_lng = 1; -} - -// A `Property` consists of a user-supplied name/value pair. -message Property { - // Name of the property. - string name = 1; - - // Value of the property. - string value = 2; - - // Value of numeric properties. - uint64 uint64_value = 3; -} - -// Set of detected entity features. -message EntityAnnotation { - // Opaque entity ID. Some IDs may be available in - // [Google Knowledge Graph Search - // API](https://developers.google.com/knowledge-graph/). - string mid = 1; - - // The language code for the locale in which the entity textual - // `description` is expressed. - string locale = 2; - - // Entity textual description, expressed in its `locale` language. - string description = 3; - - // Overall score of the result. Range [0, 1]. - float score = 4; - - // **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]. - float confidence = 5; - - // 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]. - float topicality = 6; - - // Image region to which this entity belongs. Not produced - // for `LABEL_DETECTION` features. - BoundingPoly bounding_poly = 7; - - // 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. - repeated LocationInfo locations = 8; - - // Some entities may have optional user-supplied `Property` (name/value) - // fields, such a score or string that qualifies the entity. - repeated Property properties = 9; -} - -// Set of features pertaining to the image, computed by computer vision -// methods over safe-search verticals (for example, adult, spoof, medical, -// violence). -message SafeSearchAnnotation { - // Represents the adult content likelihood for the image. Adult content may - // contain elements such as nudity, pornographic images or cartoons, or - // sexual activities. - Likelihood adult = 1; - - // Spoof likelihood. The likelihood that an modification - // was made to the image's canonical version to make it appear - // funny or offensive. - Likelihood spoof = 2; - - // Likelihood that this is a medical image. - Likelihood medical = 3; - - // Likelihood that this image contains violent content. - Likelihood violence = 4; - - // 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. - Likelihood racy = 9; -} - -// Rectangle determined by min and max `LatLng` pairs. -message LatLongRect { - // Min lat/long pair. - google.type.LatLng min_lat_lng = 1; - - // Max lat/long pair. - google.type.LatLng max_lat_lng = 2; -} - -// Color information consists of RGB channels, score, and the fraction of -// the image that the color occupies in the image. -message ColorInfo { - // RGB components of the color. - google.type.Color color = 1; - - // Image-specific score for this color. Value in range [0, 1]. - float score = 2; - - // The fraction of pixels the color occupies in the image. - // Value in range [0, 1]. - float pixel_fraction = 3; -} - -// Set of dominant colors and their corresponding scores. -message DominantColorsAnnotation { - // RGB color values with their score and pixel fraction. - repeated ColorInfo colors = 1; -} - -// Stores image properties, such as dominant colors. -message ImageProperties { - // If present, dominant colors completed successfully. - DominantColorsAnnotation dominant_colors = 1; -} - -// Single crop hint that is used to generate a new crop when serving an image. -message CropHint { - // The bounding polygon for the crop region. The coordinates of the bounding - // box are in the original image's scale, as returned in `ImageParams`. - BoundingPoly bounding_poly = 1; - - // Confidence of this being a salient region. Range [0, 1]. - float confidence = 2; - - // Fraction of importance of this salient region with respect to the original - // image. - float importance_fraction = 3; -} - -// Set of crop hints that are used to generate new crops when serving images. -message CropHintsAnnotation { - // Crop hint results. - repeated CropHint crop_hints = 1; -} - -// Parameters for crop hints annotation request. -message CropHintsParams { - // 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. - repeated float aspect_ratios = 1; -} - -// Parameters for web detection request. -message WebDetectionParams { - // Whether to include results derived from the geo information in the image. - bool include_geo_results = 2; -} - -// Parameters for text detections. This is used to control TEXT_DETECTION and -// DOCUMENT_TEXT_DETECTION features. -message TextDetectionParams { - - // By default, Cloud Vision API only includes confidence score for - // DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence - // score for TEXT_DETECTION as well. - bool enable_text_detection_confidence_score = 9; - - // A list of advanced OCR options to fine-tune OCR behavior. - repeated string advanced_ocr_options = 11; -} - -// Image context and/or feature-specific parameters. -message ImageContext { - // Not used. - LatLongRect lat_long_rect = 1; - - // 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). - repeated string language_hints = 2; - - // Parameters for crop hints annotation request. - CropHintsParams crop_hints_params = 4; - - // Parameters for web detection. - WebDetectionParams web_detection_params = 6; - - // Parameters for text detection and document text detection. - TextDetectionParams text_detection_params = 12; -} - -// Request for performing Google Cloud Vision API tasks over a user-provided -// image, with user-requested features. -message AnnotateImageRequest { - // The image to be processed. - Image image = 1; - - // Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image. - ImageContext image_context = 3; -} - -// If an image was produced from a file (e.g. a PDF), this message gives -// information about the source of that image. -message ImageAnnotationContext { - // The URI of the file used to produce the image. - string uri = 1; - - // If the file was a PDF or TIFF, this field gives the page number within - // the file used to produce the image. - int32 page_number = 2; -} - -// Response to an image annotation request. -message AnnotateImageResponse { - // If present, face detection has completed successfully. - repeated FaceAnnotation face_annotations = 1; - - // If present, landmark detection has completed successfully. - repeated EntityAnnotation landmark_annotations = 2; - - // If present, logo detection has completed successfully. - repeated EntityAnnotation logo_annotations = 3; - - // If present, label detection has completed successfully. - repeated EntityAnnotation label_annotations = 4; - - // If present, text (OCR) detection has completed successfully. - repeated EntityAnnotation text_annotations = 5; - - // If present, text (OCR) detection or document (OCR) text detection has - // completed successfully. - // This annotation provides the structural hierarchy for the OCR detected - // text. - TextAnnotation full_text_annotation = 12; - - // If present, safe-search annotation has completed successfully. - SafeSearchAnnotation safe_search_annotation = 6; - - // If present, image properties were extracted successfully. - ImageProperties image_properties_annotation = 8; - - // If present, crop hints have completed successfully. - CropHintsAnnotation crop_hints_annotation = 11; - - // If present, web detection has completed successfully. - WebDetection web_detection = 13; - - // 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. - google.rpc.Status error = 9; - - // If present, contextual information is needed to understand where this image - // comes from. - ImageAnnotationContext context = 21; -} - -// Response to a single file annotation request. A file may contain one or more -// images, which individually have their own responses. -message AnnotateFileResponse { - // Information about the file for which this response is generated. - InputConfig input_config = 1; - - // Individual responses to images found within the file. - repeated AnnotateImageResponse responses = 2; -} - -// Multiple image annotation requests are batched into a single service call. -message BatchAnnotateImagesRequest { - // Required. Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response to a batch image annotation request. -message BatchAnnotateImagesResponse { - // Individual responses to image annotation requests within the batch. - repeated AnnotateImageResponse responses = 1; -} - -// An offline file annotation request. -message AsyncAnnotateFileRequest { - // Required. Information about the input file. - InputConfig input_config = 1; - - // Required. Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image(s) in the file. - ImageContext image_context = 3; - - // Required. The desired output location and metadata (e.g. format). - OutputConfig output_config = 4; -} - -// The response for a single offline file annotation request. -message AsyncAnnotateFileResponse { - // The output location and metadata from AsyncAnnotateFileRequest. - OutputConfig output_config = 1; -} - -// Multiple async file annotation requests are batched into a single service -// call. -message AsyncBatchAnnotateFilesRequest { - // Required. Individual async file annotation requests for this batch. - repeated AsyncAnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response to an async batch file annotation request. -message AsyncBatchAnnotateFilesResponse { - // The list of file annotation responses, one for each request in - // AsyncBatchAnnotateFilesRequest. - repeated AsyncAnnotateFileResponse responses = 1; -} - -// The desired input location and metadata. -message InputConfig { - // The Google Cloud Storage location to read the input from. - GcsSource gcs_source = 1; - - // The type of the file. Currently only "application/pdf" and "image/tiff" - // are supported. Wildcards are not supported. - string mime_type = 2; -} - -// The desired output location and metadata. -message OutputConfig { - // The Google Cloud Storage location to write the output(s) to. - GcsDestination gcs_destination = 1; - - // 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. - int32 batch_size = 2; -} - -// The Google Cloud Storage location where the input will be read from. -message GcsSource { - // Google Cloud Storage URI for the input file. This must only be a GCS - // object. Wildcards are not currently supported. - string uri = 1; -} - -// The Google Cloud Storage location where the output will be written to. -message GcsDestination { - // 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. - string uri = 1; -} - -// Contains metadata for the BatchAnnotateImages operation. -message OperationMetadata { - // Batch operation states. - enum 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; - } - - // Current state of the batch operation. - State state = 1; - - // The time when the batch request was received. - google.protobuf.Timestamp create_time = 5; - - // The time when the operation result was last updated. - google.protobuf.Timestamp update_time = 6; -} - -// A bucketized representation of likelihood, which is intended to give clients -// highly stable results across model upgrades. -enum 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; -} diff --git a/protos/google/cloud/vision/v1p2beta1/text_annotation.proto b/protos/google/cloud/vision/v1p2beta1/text_annotation.proto deleted file mode 100644 index af568194..00000000 --- a/protos/google/cloud/vision/v1p2beta1/text_annotation.proto +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2018 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p2beta1; - -import "google/cloud/vision/v1p2beta1/geometry.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "TextAnnotationProto"; -option java_package = "com.google.cloud.vision.v1p2beta1"; - -// 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][google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty] -// message definition below for more detail. -message TextAnnotation { - // Detected language for a structural component. - message DetectedLanguage { - // The BCP-47 language code, such as "en-US" or "sr-Latn". For more - // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - string language_code = 1; - - // Confidence of detected language. Range [0, 1]. - float confidence = 2; - } - - // Detected start or end of a structural component. - message DetectedBreak { - // Enum to denote the type of break found. New line, space etc. - enum 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; - } - - // Detected break type. - BreakType type = 1; - - // True if break prepends the element. - bool is_prefix = 2; - } - - // Additional information detected on the structural component. - message TextProperty { - // A list of detected languages together with confidence. - repeated DetectedLanguage detected_languages = 1; - - // Detected start or end of a text segment. - DetectedBreak detected_break = 2; - } - - // List of pages detected by OCR. - repeated Page pages = 1; - - // UTF-8 text detected on the pages. - string text = 2; -} - -// Detected page from OCR. -message Page { - // Additional information detected on the page. - TextAnnotation.TextProperty property = 1; - - // Page width. For PDFs the unit is points. For images (including - // TIFFs) the unit is pixels. - int32 width = 2; - - // Page height. For PDFs the unit is points. For images (including - // TIFFs) the unit is pixels. - int32 height = 3; - - // List of blocks of text, images etc on this page. - repeated Block blocks = 4; - - // Confidence of the OCR results on the page. Range [0, 1]. - float confidence = 5; -} - -// Logical element on the page. -message Block { - // Type of a block (text, image etc) as identified by OCR. - enum 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; - } - - // Additional information detected for the block. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of paragraphs in this block (if this blocks is of type text). - repeated Paragraph paragraphs = 3; - - // Detected block type (text, image etc) for this block. - BlockType block_type = 4; - - // Confidence of the OCR results on the block. Range [0, 1]. - float confidence = 5; -} - -// Structural unit of text representing a number of words in certain order. -message Paragraph { - // Additional information detected for the paragraph. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of words in this paragraph. - repeated Word words = 3; - - // Confidence of the OCR results for the paragraph. Range [0, 1]. - float confidence = 4; -} - -// A word representation. -message Word { - // Additional information detected for the word. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of symbols in the word. - // The order of the symbols follows the natural reading order. - repeated Symbol symbols = 3; - - // Confidence of the OCR results for the word. Range [0, 1]. - float confidence = 4; -} - -// A single symbol representation. -message Symbol { - // Additional information detected for the symbol. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // The actual UTF-8 representation of the symbol. - string text = 3; - - // Confidence of the OCR results for the symbol. Range [0, 1]. - float confidence = 4; -} diff --git a/protos/google/cloud/vision/v1p2beta1/web_detection.proto b/protos/google/cloud/vision/v1p2beta1/web_detection.proto deleted file mode 100644 index 2decb859..00000000 --- a/protos/google/cloud/vision/v1p2beta1/web_detection.proto +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2018 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p2beta1; - - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "WebDetectionProto"; -option java_package = "com.google.cloud.vision.v1p2beta1"; - -// Relevant information for the image from the Internet. -message WebDetection { - // Entity deduced from similar images on the Internet. - message WebEntity { - // Opaque entity ID. - string entity_id = 1; - - // Overall relevancy score for the entity. - // Not normalized and not comparable across different image queries. - float score = 2; - - // Canonical description of the entity, in English. - string description = 3; - } - - // Metadata for online images. - message WebImage { - // The result image URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the image. - float score = 2; - } - - // Metadata for web pages. - message WebPage { - // The result web page URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the web page. - float score = 2; - - // Title for the web page, may contain HTML markups. - string page_title = 3; - - // Fully matching images on the page. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 4; - - // 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. - repeated WebImage partial_matching_images = 5; - } - - // Label to provide extra metadata for the web detection. - message WebLabel { - // Label for extra metadata. - string label = 1; - - // 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. - string language_code = 2; - } - - // Deduced entities from similar images on the Internet. - repeated WebEntity web_entities = 1; - - // Fully matching images from the Internet. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 2; - - // 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. - repeated WebImage partial_matching_images = 3; - - // Web pages containing the matching images from the Internet. - repeated WebPage pages_with_matching_images = 4; - - // The visually similar image results. - repeated WebImage visually_similar_images = 6; - - // Best guess text labels for the request image. - repeated WebLabel best_guess_labels = 8; -} diff --git a/protos/google/cloud/vision/v1p3beta1/geometry.proto b/protos/google/cloud/vision/v1p3beta1/geometry.proto deleted file mode 100644 index c2c524fb..00000000 --- a/protos/google/cloud/vision/v1p3beta1/geometry.proto +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p3beta1; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "GeometryProto"; -option java_package = "com.google.cloud.vision.v1p3beta1"; -option objc_class_prefix = "GCVN"; - -// A vertex represents a 2D point in the image. -// NOTE: the vertex coordinates are in the same scale as the original image. -message Vertex { - // X coordinate. - int32 x = 1; - - // Y coordinate. - int32 y = 2; -} - -// 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. -message NormalizedVertex { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; -} - -// A bounding polygon for the detected image annotation. -message BoundingPoly { - // The bounding polygon vertices. - repeated Vertex vertices = 1; - - // The bounding polygon normalized vertices. - repeated NormalizedVertex normalized_vertices = 2; -} - -// 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. -message Position { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; - - // Z coordinate (or depth). - float z = 3; -} diff --git a/protos/google/cloud/vision/v1p3beta1/image_annotator.proto b/protos/google/cloud/vision/v1p3beta1/image_annotator.proto deleted file mode 100644 index ebab14a6..00000000 --- a/protos/google/cloud/vision/v1p3beta1/image_annotator.proto +++ /dev/null @@ -1,833 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p3beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/vision/v1p3beta1/geometry.proto"; -import "google/cloud/vision/v1p3beta1/product_search.proto"; -import "google/cloud/vision/v1p3beta1/text_annotation.proto"; -import "google/cloud/vision/v1p3beta1/web_detection.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/color.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ImageAnnotatorProto"; -option java_package = "com.google.cloud.vision.v1p3beta1"; - -// 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 ImageAnnotator { - option (google.api.default_host) = "vision.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-vision"; - - // Run image detection and annotation for a batch of images. - rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) { - option (google.api.http) = { - post: "/v1p3beta1/images:annotate" - body: "*" - }; - option (google.api.method_signature) = "requests"; - } - - // 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). - rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p3beta1/files:asyncBatchAnnotate" - body: "*" - }; - option (google.api.method_signature) = "requests"; - option (google.longrunning.operation_info) = { - response_type: "AsyncBatchAnnotateFilesResponse" - metadata_type: "OperationMetadata" - }; - } -} - -// 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. -message Feature { - // Type of Google Cloud Vision API feature to be extracted. - enum 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; - } - - // The feature type. - Type type = 1; - - // Maximum number of results of this type. Does not apply to - // `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - int32 max_results = 2; - - // Model to use for the feature. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also - // support "builtin/weekly" for the bleeding edge release updated weekly. - string model = 3; -} - -// External image source (Google Cloud Storage or web URL image location). -message ImageSource { - // **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. - string gcs_image_uri = 1; - - // 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. - string image_uri = 2; -} - -// Client image to perform Google Cloud Vision API tasks over. -message Image { - // 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. - bytes content = 1; - - // 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. - ImageSource source = 2; -} - -// A face annotation object contains the results of face detection. -message FaceAnnotation { - // A face-specific landmark (for example, a face feature). - message Landmark { - // 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 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; - } - - // Face landmark type. - Type type = 3; - - // Face landmark position. - Position position = 4; - } - - // 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. - BoundingPoly bounding_poly = 1; - - // 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. - BoundingPoly fd_bounding_poly = 2; - - // Detected face landmarks. - repeated Landmark landmarks = 3; - - // 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]. - float roll_angle = 4; - - // 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]. - float pan_angle = 5; - - // Pitch angle, which indicates the upwards/downwards angle that the face is - // pointing relative to the image's horizontal plane. Range [-180,180]. - float tilt_angle = 6; - - // Detection confidence. Range [0, 1]. - float detection_confidence = 7; - - // Face landmarking confidence. Range [0, 1]. - float landmarking_confidence = 8; - - // Joy likelihood. - Likelihood joy_likelihood = 9; - - // Sorrow likelihood. - Likelihood sorrow_likelihood = 10; - - // Anger likelihood. - Likelihood anger_likelihood = 11; - - // Surprise likelihood. - Likelihood surprise_likelihood = 12; - - // Under-exposed likelihood. - Likelihood under_exposed_likelihood = 13; - - // Blurred likelihood. - Likelihood blurred_likelihood = 14; - - // Headwear likelihood. - Likelihood headwear_likelihood = 15; -} - -// Detected entity location information. -message LocationInfo { - // lat/long location coordinates. - google.type.LatLng lat_lng = 1; -} - -// A `Property` consists of a user-supplied name/value pair. -message Property { - // Name of the property. - string name = 1; - - // Value of the property. - string value = 2; - - // Value of numeric properties. - uint64 uint64_value = 3; -} - -// Set of detected entity features. -message EntityAnnotation { - // Opaque entity ID. Some IDs may be available in - // [Google Knowledge Graph Search - // API](https://developers.google.com/knowledge-graph/). - string mid = 1; - - // The language code for the locale in which the entity textual - // `description` is expressed. - string locale = 2; - - // Entity textual description, expressed in its `locale` language. - string description = 3; - - // Overall score of the result. Range [0, 1]. - float score = 4; - - // **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]. - float confidence = 5; - - // 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]. - float topicality = 6; - - // Image region to which this entity belongs. Not produced - // for `LABEL_DETECTION` features. - BoundingPoly bounding_poly = 7; - - // 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. - repeated LocationInfo locations = 8; - - // Some entities may have optional user-supplied `Property` (name/value) - // fields, such a score or string that qualifies the entity. - repeated Property properties = 9; -} - -// Set of detected objects with bounding boxes. -message LocalizedObjectAnnotation { - // Object ID that should align with EntityAnnotation mid. - string mid = 1; - - // 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. - string language_code = 2; - - // Object name, expressed in its `language_code` language. - string name = 3; - - // Score of the result. Range [0, 1]. - float score = 4; - - // Image region to which this object belongs. This must be populated. - BoundingPoly bounding_poly = 5; -} - -// Set of features pertaining to the image, computed by computer vision -// methods over safe-search verticals (for example, adult, spoof, medical, -// violence). -message SafeSearchAnnotation { - // Represents the adult content likelihood for the image. Adult content may - // contain elements such as nudity, pornographic images or cartoons, or - // sexual activities. - Likelihood adult = 1; - - // Spoof likelihood. The likelihood that an modification - // was made to the image's canonical version to make it appear - // funny or offensive. - Likelihood spoof = 2; - - // Likelihood that this is a medical image. - Likelihood medical = 3; - - // Likelihood that this image contains violent content. - Likelihood violence = 4; - - // 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. - Likelihood racy = 9; -} - -// Rectangle determined by min and max `LatLng` pairs. -message LatLongRect { - // Min lat/long pair. - google.type.LatLng min_lat_lng = 1; - - // Max lat/long pair. - google.type.LatLng max_lat_lng = 2; -} - -// Color information consists of RGB channels, score, and the fraction of -// the image that the color occupies in the image. -message ColorInfo { - // RGB components of the color. - google.type.Color color = 1; - - // Image-specific score for this color. Value in range [0, 1]. - float score = 2; - - // The fraction of pixels the color occupies in the image. - // Value in range [0, 1]. - float pixel_fraction = 3; -} - -// Set of dominant colors and their corresponding scores. -message DominantColorsAnnotation { - // RGB color values with their score and pixel fraction. - repeated ColorInfo colors = 1; -} - -// Stores image properties, such as dominant colors. -message ImageProperties { - // If present, dominant colors completed successfully. - DominantColorsAnnotation dominant_colors = 1; -} - -// Single crop hint that is used to generate a new crop when serving an image. -message CropHint { - // The bounding polygon for the crop region. The coordinates of the bounding - // box are in the original image's scale, as returned in `ImageParams`. - BoundingPoly bounding_poly = 1; - - // Confidence of this being a salient region. Range [0, 1]. - float confidence = 2; - - // Fraction of importance of this salient region with respect to the original - // image. - float importance_fraction = 3; -} - -// Set of crop hints that are used to generate new crops when serving images. -message CropHintsAnnotation { - // Crop hint results. - repeated CropHint crop_hints = 1; -} - -// Parameters for crop hints annotation request. -message CropHintsParams { - // 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. - repeated float aspect_ratios = 1; -} - -// Parameters for web detection request. -message WebDetectionParams { - // Whether to include results derived from the geo information in the image. - bool include_geo_results = 2; -} - -// Parameters for text detections. This is used to control TEXT_DETECTION and -// DOCUMENT_TEXT_DETECTION features. -message TextDetectionParams { - - // By default, Cloud Vision API only includes confidence score for - // DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence - // score for TEXT_DETECTION as well. - bool enable_text_detection_confidence_score = 9; - - // A list of advanced OCR options to fine-tune OCR behavior. - repeated string advanced_ocr_options = 11; -} - -// Image context and/or feature-specific parameters. -message ImageContext { - // Not used. - LatLongRect lat_long_rect = 1; - - // 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). - repeated string language_hints = 2; - - // Parameters for crop hints annotation request. - CropHintsParams crop_hints_params = 4; - - // Parameters for product search. - google.cloud.vision.v1p3beta1.ProductSearchParams product_search_params = 5; - - // Parameters for web detection. - WebDetectionParams web_detection_params = 6; - - // Parameters for text detection and document text detection. - TextDetectionParams text_detection_params = 12; -} - -// Request for performing Google Cloud Vision API tasks over a user-provided -// image, with user-requested features. -message AnnotateImageRequest { - // The image to be processed. - Image image = 1; - - // Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image. - ImageContext image_context = 3; -} - -// If an image was produced from a file (e.g. a PDF), this message gives -// information about the source of that image. -message ImageAnnotationContext { - // The URI of the file used to produce the image. - string uri = 1; - - // If the file was a PDF or TIFF, this field gives the page number within - // the file used to produce the image. - int32 page_number = 2; -} - -// Response to an image annotation request. -message AnnotateImageResponse { - // If present, face detection has completed successfully. - repeated FaceAnnotation face_annotations = 1; - - // If present, landmark detection has completed successfully. - repeated EntityAnnotation landmark_annotations = 2; - - // If present, logo detection has completed successfully. - repeated EntityAnnotation logo_annotations = 3; - - // If present, label detection has completed successfully. - repeated EntityAnnotation label_annotations = 4; - - // If present, localized object detection has completed successfully. - // This will be sorted descending by confidence score. - repeated LocalizedObjectAnnotation localized_object_annotations = 22; - - // If present, text (OCR) detection has completed successfully. - repeated EntityAnnotation text_annotations = 5; - - // If present, text (OCR) detection or document (OCR) text detection has - // completed successfully. - // This annotation provides the structural hierarchy for the OCR detected - // text. - TextAnnotation full_text_annotation = 12; - - // If present, safe-search annotation has completed successfully. - SafeSearchAnnotation safe_search_annotation = 6; - - // If present, image properties were extracted successfully. - ImageProperties image_properties_annotation = 8; - - // If present, crop hints have completed successfully. - CropHintsAnnotation crop_hints_annotation = 11; - - // If present, web detection has completed successfully. - WebDetection web_detection = 13; - - // If present, product search has completed successfully. - google.cloud.vision.v1p3beta1.ProductSearchResults product_search_results = - 14; - - // 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. - google.rpc.Status error = 9; - - // If present, contextual information is needed to understand where this image - // comes from. - ImageAnnotationContext context = 21; -} - -// Response to a single file annotation request. A file may contain one or more -// images, which individually have their own responses. -message AnnotateFileResponse { - // Information about the file for which this response is generated. - InputConfig input_config = 1; - - // Individual responses to images found within the file. - repeated AnnotateImageResponse responses = 2; -} - -// Multiple image annotation requests are batched into a single service call. -message BatchAnnotateImagesRequest { - // Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response to a batch image annotation request. -message BatchAnnotateImagesResponse { - // Individual responses to image annotation requests within the batch. - repeated AnnotateImageResponse responses = 1; -} - -// An offline file annotation request. -message AsyncAnnotateFileRequest { - // Required. Information about the input file. - InputConfig input_config = 1; - - // Required. Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image(s) in the file. - ImageContext image_context = 3; - - // Required. The desired output location and metadata (e.g. format). - OutputConfig output_config = 4; -} - -// The response for a single offline file annotation request. -message AsyncAnnotateFileResponse { - // The output location and metadata from AsyncAnnotateFileRequest. - OutputConfig output_config = 1; -} - -// Multiple async file annotation requests are batched into a single service -// call. -message AsyncBatchAnnotateFilesRequest { - // Required. Individual async file annotation requests for this batch. - repeated AsyncAnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response to an async batch file annotation request. -message AsyncBatchAnnotateFilesResponse { - // The list of file annotation responses, one for each request in - // AsyncBatchAnnotateFilesRequest. - repeated AsyncAnnotateFileResponse responses = 1; -} - -// The desired input location and metadata. -message InputConfig { - // The Google Cloud Storage location to read the input from. - GcsSource gcs_source = 1; - - // The type of the file. Currently only "application/pdf" and "image/tiff" - // are supported. Wildcards are not supported. - string mime_type = 2; -} - -// The desired output location and metadata. -message OutputConfig { - // The Google Cloud Storage location to write the output(s) to. - GcsDestination gcs_destination = 1; - - // 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. - int32 batch_size = 2; -} - -// The Google Cloud Storage location where the input will be read from. -message GcsSource { - // Google Cloud Storage URI for the input file. This must only be a - // Google Cloud Storage object. Wildcards are not currently supported. - string uri = 1; -} - -// The Google Cloud Storage location where the output will be written to. -message GcsDestination { - // 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. - string uri = 1; -} - -// A bucketized representation of likelihood, which is intended to give clients -// highly stable results across model upgrades. -enum 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; -} - -// Contains metadata for the BatchAnnotateImages operation. -message OperationMetadata { - // Batch operation states. - enum 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; - } - // Current state of the batch operation. - State state = 1; - - // The time when the batch request was received. - google.protobuf.Timestamp create_time = 5; - - // The time when the operation result was last updated. - google.protobuf.Timestamp update_time = 6; -} diff --git a/protos/google/cloud/vision/v1p3beta1/product_search.proto b/protos/google/cloud/vision/v1p3beta1/product_search.proto deleted file mode 100644 index 86ea1a06..00000000 --- a/protos/google/cloud/vision/v1p3beta1/product_search.proto +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p3beta1; - -import "google/api/resource.proto"; -import "google/cloud/vision/v1p3beta1/geometry.proto"; -import "google/cloud/vision/v1p3beta1/product_search_service.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ProductSearchProto"; -option java_package = "com.google.cloud.vision.v1p3beta1"; -option objc_class_prefix = "GCVN"; - -// Parameters for a product search request. -message ProductSearchParams { - // The bounding polygon around the area of interest in the image. - // If it is not specified, system discretion will be applied. - BoundingPoly bounding_poly = 9; - - // The resource name of a [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] to be searched for similar images. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - string product_set = 6 [(google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - }]; - - // 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. - repeated string product_categories = 7; - - // 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 '='. - string filter = 8; -} - -// Results for a product search request. -message ProductSearchResults { - // Information about a product. - message Result { - // The Product. - Product product = 1; - - // A confidence level on the match, ranging from 0 (no confidence) to - // 1 (full confidence). - float score = 2; - - // The resource name of the image from the product that is the closest match - // to the query. - string image = 3; - } - - // Prediction for what the object in the bounding box is. - message ObjectAnnotation { - // Object ID that should align with EntityAnnotation mid. - string mid = 1; - - // 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. - string language_code = 2; - - // Object name, expressed in its `language_code` language. - string name = 3; - - // Score of the result. Range [0, 1]. - float score = 4; - } - - // Information about the products similar to a single product in a query - // image. - message GroupedResult { - // The bounding polygon around the product detected in the query image. - BoundingPoly bounding_poly = 1; - - // List of results, one for each product match. - repeated Result results = 2; - - // List of generic predictions for the object in the bounding box. - repeated ObjectAnnotation object_annotations = 3; - } - - // 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. - google.protobuf.Timestamp index_time = 2; - - // List of results, one for each product match. - repeated Result results = 5; - - // 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. - repeated GroupedResult product_grouped_results = 6; -} diff --git a/protos/google/cloud/vision/v1p3beta1/product_search_service.proto b/protos/google/cloud/vision/v1p3beta1/product_search_service.proto deleted file mode 100644 index daf1d0dd..00000000 --- a/protos/google/cloud/vision/v1p3beta1/product_search_service.proto +++ /dev/null @@ -1,971 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p3beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/vision/v1p3beta1/geometry.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ProductSearchServiceProto"; -option java_package = "com.google.cloud.vision.v1p3beta1"; - -// 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/*` -service ProductSearch { - option (google.api.default_host) = "vision.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-vision"; - - // Creates and returns a new ProductSet resource. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if display_name is missing, or is longer than - // 4096 characters. - rpc CreateProductSet(CreateProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - post: "/v1p3beta1/{parent=projects/*/locations/*}/productSets" - body: "product_set" - }; - option (google.api.method_signature) = "parent,product_set,product_set_id"; - } - - // Lists ProductSets in an unspecified order. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if page_size is greater than 100, or less - // than 1. - rpc ListProductSets(ListProductSetsRequest) returns (ListProductSetsResponse) { - option (google.api.http) = { - get: "/v1p3beta1/{parent=projects/*/locations/*}/productSets" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a ProductSet. - // - // Possible errors: - // - // * Returns NOT_FOUND if the ProductSet does not exist. - rpc GetProductSet(GetProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - get: "/v1p3beta1/{name=projects/*/locations/*/productSets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc UpdateProductSet(UpdateProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - patch: "/v1p3beta1/{product_set.name=projects/*/locations/*/productSets/*}" - body: "product_set" - }; - option (google.api.method_signature) = "product_set,update_mask"; - } - - // 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. - rpc DeleteProductSet(DeleteProductSetRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p3beta1/{name=projects/*/locations/*/productSets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc CreateProduct(CreateProductRequest) returns (Product) { - option (google.api.http) = { - post: "/v1p3beta1/{parent=projects/*/locations/*}/products" - body: "product" - }; - option (google.api.method_signature) = "parent,product,product_id"; - } - - // Lists products in an unspecified order. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) { - option (google.api.http) = { - get: "/v1p3beta1/{parent=projects/*/locations/*}/products" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a Product. - // - // Possible errors: - // - // * Returns NOT_FOUND if the Product does not exist. - rpc GetProduct(GetProductRequest) returns (Product) { - option (google.api.http) = { - get: "/v1p3beta1/{name=projects/*/locations/*/products/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc UpdateProduct(UpdateProductRequest) returns (Product) { - option (google.api.http) = { - patch: "/v1p3beta1/{product.name=projects/*/locations/*/products/*}" - body: "product" - }; - option (google.api.method_signature) = "product,update_mask"; - } - - // 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. - rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p3beta1/{name=projects/*/locations/*/products/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc CreateReferenceImage(CreateReferenceImageRequest) - returns (ReferenceImage) { - option (google.api.http) = { - post: "/v1p3beta1/{parent=projects/*/locations/*/products/*}/referenceImages" - body: "reference_image" - }; - option (google.api.method_signature) = "parent,reference_image,reference_image_id"; - } - - // 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. - rpc DeleteReferenceImage(DeleteReferenceImageRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p3beta1/{name=projects/*/locations/*/products/*/referenceImages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc ListReferenceImages(ListReferenceImagesRequest) - returns (ListReferenceImagesResponse) { - option (google.api.http) = { - get: "/v1p3beta1/{parent=projects/*/locations/*/products/*}/referenceImages" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a ReferenceImage. - // - // Possible errors: - // - // * Returns NOT_FOUND if the specified image does not exist. - rpc GetReferenceImage(GetReferenceImageRequest) returns (ReferenceImage) { - option (google.api.http) = { - get: "/v1p3beta1/{name=projects/*/locations/*/products/*/referenceImages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc AddProductToProductSet(AddProductToProductSetRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1p3beta1/{name=projects/*/locations/*/productSets/*}:addProduct" - body: "*" - }; - option (google.api.method_signature) = "name,product"; - } - - // Removes a Product from the specified ProductSet. - // - // Possible errors: - // - // * Returns NOT_FOUND If the Product is not found under the ProductSet. - rpc RemoveProductFromProductSet(RemoveProductFromProductSetRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1p3beta1/{name=projects/*/locations/*/productSets/*}:removeProduct" - body: "*" - }; - option (google.api.method_signature) = "name,product"; - } - - // 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. - rpc ListProductsInProductSet(ListProductsInProductSetRequest) - returns (ListProductsInProductSetResponse) { - option (google.api.http) = { - get: "/v1p3beta1/{name=projects/*/locations/*/productSets/*}/products" - }; - option (google.api.method_signature) = "name"; - } - - // 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]. - rpc ImportProductSets(ImportProductSetsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p3beta1/{parent=projects/*/locations/*}/productSets:import" - body: "*" - }; - option (google.api.method_signature) = "parent,input_config"; - option (google.longrunning.operation_info) = { - response_type: "ImportProductSetsResponse" - metadata_type: "BatchOperationMetadata" - }; - } -} - -// A Product contains ReferenceImages. -message Product { - option (google.api.resource) = { - type: "vision.googleapis.com/Product" - pattern: "projects/{project}/locations/{location}/products/{product}" - }; - - // A product label represented as a key-value pair. - message KeyValue { - // The key of the label attached to the product. Cannot be empty and cannot - // exceed 128 bytes. - string key = 1; - - // The value of the label attached to the product. Cannot be empty and - // cannot exceed 128 bytes. - string value = 2; - } - - // 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. - string name = 1; - - // The user-provided name for this Product. Must not be empty. Must be at most - // 4096 characters long. - string display_name = 2; - - // User-provided metadata to be stored with this product. Must be at most 4096 - // characters long. - string description = 3; - - // 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. - string product_category = 4 [(google.api.field_behavior) = IMMUTABLE]; - - // 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. - repeated KeyValue product_labels = 5; -} - -// A ProductSet contains Products. A ProductSet can contain a maximum of 1 -// million reference images. If the limit is exceeded, periodic indexing will -// fail. -message ProductSet { - option (google.api.resource) = { - type: "vision.googleapis.com/ProductSet" - pattern: "projects/{project}/locations/{location}/productSets/{product_set}" - }; - - // 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. - string name = 1; - - // The user-provided name for this ProductSet. Must not be empty. Must be at - // most 4096 characters long. - string display_name = 2; - - // 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. - google.protobuf.Timestamp index_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If there was an error with indexing the product set, the field - // is populated. - // - // This field is ignored when creating a ProductSet. - google.rpc.Status index_error = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A `ReferenceImage` represents a product image and its associated metadata, -// such as bounding boxes. -message ReferenceImage { - option (google.api.resource) = { - type: "vision.googleapis.com/ReferenceImage" - pattern: "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}" - }; - - // 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. - string name = 1; - - // Required. The Google Cloud Storage URI of the reference image. - // - // The URI must start with `gs://`. - string uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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). - repeated BoundingPoly bounding_polys = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for the `CreateProduct` method. -message CreateProductRequest { - // Required. The project in which the Product should be created. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The product to create. - Product product = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string product_id = 3; -} - -// Request message for the `ListProducts` method. -message ListProductsRequest { - // Required. The project OR ProductSet from which Products should be listed. - // - // Format: - // `projects/PROJECT_ID/locations/LOC_ID` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProducts` method. -message ListProductsResponse { - // List of products. - repeated Product products = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for the `GetProduct` method. -message GetProductRequest { - // Required. Resource name of the Product to get. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; -} - -// Request message for the `UpdateProduct` method. -message UpdateProductRequest { - // Required. The Product resource which replaces the one on the server. - // product.name is immutable. - Product product = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for the `DeleteProduct` method. -message DeleteProductRequest { - // Required. Resource name of product to delete. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; -} - -// Request message for the `CreateProductSet` method. -message CreateProductSetRequest { - // Required. The project in which the ProductSet should be created. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The ProductSet to create. - ProductSet product_set = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string product_set_id = 3; -} - -// Request message for the `ListProductSets` method. -message ListProductSetsRequest { - // Required. The project from which ProductSets should be listed. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProductSets` method. -message ListProductSetsResponse { - // List of ProductSets. - repeated ProductSet product_sets = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for the `GetProductSet` method. -message GetProductSetRequest { - // Required. Resource name of the ProductSet to get. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; -} - -// Request message for the `UpdateProductSet` method. -message UpdateProductSetRequest { - // Required. The ProductSet resource which replaces the one on the server. - ProductSet product_set = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for the `DeleteProductSet` method. -message DeleteProductSetRequest { - // Required. Resource name of the ProductSet to delete. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; -} - -// Request message for the `CreateReferenceImage` method. -message CreateReferenceImageRequest { - // Required. Resource name of the product in which to create the reference image. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; - - // Required. The reference image to create. - // If an image ID is specified, it is ignored. - ReferenceImage reference_image = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string reference_image_id = 3; -} - -// Request message for the `ListReferenceImages` method. -message ListReferenceImagesRequest { - // Required. Resource name of the product containing the reference images. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // 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. - string page_token = 3; -} - -// Response message for the `ListReferenceImages` method. -message ListReferenceImagesResponse { - // The list of reference images. - repeated ReferenceImage reference_images = 1; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string next_page_token = 3; -} - -// Request message for the `GetReferenceImage` method. -message GetReferenceImageRequest { - // Required. The resource name of the ReferenceImage to get. - // - // Format is: - // - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ReferenceImage" - } - ]; -} - -// Request message for the `DeleteReferenceImage` method. -message DeleteReferenceImageRequest { - // Required. The resource name of the reference image to delete. - // - // Format is: - // - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ReferenceImage" - } - ]; -} - -// Request message for the `AddProductToProductSet` method. -message AddProductToProductSetRequest { - // Required. The resource name for the ProductSet to modify. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // Required. The resource name for the Product to be added to this ProductSet. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string product = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; -} - -// Request message for the `RemoveProductFromProductSet` method. -message RemoveProductFromProductSetRequest { - // Required. The resource name for the ProductSet to modify. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // Required. The resource name for the Product to be removed from this ProductSet. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string product = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/Product" - } - ]; -} - -// Request message for the `ListProductsInProductSet` method. -message ListProductsInProductSetRequest { - // Required. The ProductSet resource for which to retrieve Products. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProductsInProductSet` method. -message ListProductsInProductSetResponse { - // The list of Products. - repeated Product products = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// The Google Cloud Storage location for a csv file which preserves a list of -// ImportProductSetRequests in each line. -message ImportProductSetsGcsSource { - // 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][google.cloud.vision.v1p3beta1.Product.display_name], - // the product_category field refers to - // [Product.product_category][google.cloud.vision.v1p3beta1.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. - string csv_file_uri = 1; -} - -// The input content for the `ImportProductSets` method. -message ImportProductSetsInputConfig { - // The source of the input. - oneof source { - // The Google Cloud Storage location for a csv file which preserves a list - // of ImportProductSetRequests in each line. - ImportProductSetsGcsSource gcs_source = 1; - } -} - -// Request message for the `ImportProductSets` method. -message ImportProductSetsRequest { - // Required. The project in which the ProductSets should be imported. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The input content for the list of requests. - ImportProductSetsInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for the `ImportProductSets` method. -// -// This message is returned by the -// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] -// method in the returned -// [google.longrunning.Operation.response][google.longrunning.Operation.response] -// field. -message ImportProductSetsResponse { - // The list of reference_images that are imported successfully. - repeated ReferenceImage reference_images = 1; - - // 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. - repeated google.rpc.Status statuses = 2; -} - -// 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. -message BatchOperationMetadata { - // Enumerates the possible states that the batch request can be in. - enum 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; - } - - // The current state of the batch operation. - State state = 1; - - // The time when the batch request was submitted to the server. - google.protobuf.Timestamp submit_time = 2; - - // The time when the batch request is finished and - // [google.longrunning.Operation.done][google.longrunning.Operation.done] is - // set to true. - google.protobuf.Timestamp end_time = 3; -} diff --git a/protos/google/cloud/vision/v1p3beta1/text_annotation.proto b/protos/google/cloud/vision/v1p3beta1/text_annotation.proto deleted file mode 100644 index 633e404e..00000000 --- a/protos/google/cloud/vision/v1p3beta1/text_annotation.proto +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2018 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p3beta1; - -import "google/cloud/vision/v1p3beta1/geometry.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "TextAnnotationProto"; -option java_package = "com.google.cloud.vision.v1p3beta1"; - -// 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][google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty] -// message definition below for more detail. -message TextAnnotation { - // Detected language for a structural component. - message DetectedLanguage { - // The BCP-47 language code, such as "en-US" or "sr-Latn". For more - // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - string language_code = 1; - - // Confidence of detected language. Range [0, 1]. - float confidence = 2; - } - - // Detected start or end of a structural component. - message DetectedBreak { - // Enum to denote the type of break found. New line, space etc. - enum 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; - } - - // Detected break type. - BreakType type = 1; - - // True if break prepends the element. - bool is_prefix = 2; - } - - // Additional information detected on the structural component. - message TextProperty { - // A list of detected languages together with confidence. - repeated DetectedLanguage detected_languages = 1; - - // Detected start or end of a text segment. - DetectedBreak detected_break = 2; - } - - // List of pages detected by OCR. - repeated Page pages = 1; - - // UTF-8 text detected on the pages. - string text = 2; -} - -// Detected page from OCR. -message Page { - // Additional information detected on the page. - TextAnnotation.TextProperty property = 1; - - // Page width. For PDFs the unit is points. For images (including - // TIFFs) the unit is pixels. - int32 width = 2; - - // Page height. For PDFs the unit is points. For images (including - // TIFFs) the unit is pixels. - int32 height = 3; - - // List of blocks of text, images etc on this page. - repeated Block blocks = 4; - - // Confidence of the OCR results on the page. Range [0, 1]. - float confidence = 5; -} - -// Logical element on the page. -message Block { - // Type of a block (text, image etc) as identified by OCR. - enum 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; - } - - // Additional information detected for the block. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of paragraphs in this block (if this blocks is of type text). - repeated Paragraph paragraphs = 3; - - // Detected block type (text, image etc) for this block. - BlockType block_type = 4; - - // Confidence of the OCR results on the block. Range [0, 1]. - float confidence = 5; -} - -// Structural unit of text representing a number of words in certain order. -message Paragraph { - // Additional information detected for the paragraph. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of words in this paragraph. - repeated Word words = 3; - - // Confidence of the OCR results for the paragraph. Range [0, 1]. - float confidence = 4; -} - -// A word representation. -message Word { - // Additional information detected for the word. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of symbols in the word. - // The order of the symbols follows the natural reading order. - repeated Symbol symbols = 3; - - // Confidence of the OCR results for the word. Range [0, 1]. - float confidence = 4; -} - -// A single symbol representation. -message Symbol { - // Additional information detected for the symbol. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // The actual UTF-8 representation of the symbol. - string text = 3; - - // Confidence of the OCR results for the symbol. Range [0, 1]. - float confidence = 4; -} diff --git a/protos/google/cloud/vision/v1p3beta1/web_detection.proto b/protos/google/cloud/vision/v1p3beta1/web_detection.proto deleted file mode 100644 index 205dfe65..00000000 --- a/protos/google/cloud/vision/v1p3beta1/web_detection.proto +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2018 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.vision.v1p3beta1; - - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "WebDetectionProto"; -option java_package = "com.google.cloud.vision.v1p3beta1"; - -// Relevant information for the image from the Internet. -message WebDetection { - // Entity deduced from similar images on the Internet. - message WebEntity { - // Opaque entity ID. - string entity_id = 1; - - // Overall relevancy score for the entity. - // Not normalized and not comparable across different image queries. - float score = 2; - - // Canonical description of the entity, in English. - string description = 3; - } - - // Metadata for online images. - message WebImage { - // The result image URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the image. - float score = 2; - } - - // Metadata for web pages. - message WebPage { - // The result web page URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the web page. - float score = 2; - - // Title for the web page, may contain HTML markups. - string page_title = 3; - - // Fully matching images on the page. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 4; - - // 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. - repeated WebImage partial_matching_images = 5; - } - - // Label to provide extra metadata for the web detection. - message WebLabel { - // Label for extra metadata. - string label = 1; - - // 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. - string language_code = 2; - } - - // Deduced entities from similar images on the Internet. - repeated WebEntity web_entities = 1; - - // Fully matching images from the Internet. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 2; - - // 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. - repeated WebImage partial_matching_images = 3; - - // Web pages containing the matching images from the Internet. - repeated WebPage pages_with_matching_images = 4; - - // The visually similar image results. - repeated WebImage visually_similar_images = 6; - - // Best guess text labels for the request image. - repeated WebLabel best_guess_labels = 8; -} diff --git a/protos/google/cloud/vision/v1p4beta1/face.proto b/protos/google/cloud/vision/v1p4beta1/face.proto deleted file mode 100644 index d2ab72f0..00000000 --- a/protos/google/cloud/vision/v1p4beta1/face.proto +++ /dev/null @@ -1,60 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p4beta1; - -import "google/cloud/vision/v1p4beta1/geometry.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "CelebrityProto"; -option java_package = "com.google.cloud.vision.v1p4beta1"; -option objc_class_prefix = "GCVN"; - -// Parameters for a celebrity recognition request. -message FaceRecognitionParams { - // The resource names for one or more - // [CelebritySet][google.cloud.vision.v1p4beta1.CelebritySet]s. 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. - repeated string celebrity_set = 1; -} - -// A Celebrity is a group of Faces with an identity. -message Celebrity { - // The resource name of the preloaded Celebrity. Has the format - // `builtin/{mid}`. - string name = 1; - - // The Celebrity's display name. - string display_name = 2; - - // The Celebrity's description. - string description = 3; -} - -// Information about a face's identity. -message FaceRecognitionResult { - // The [Celebrity][google.cloud.vision.v1p4beta1.Celebrity] that this face was - // matched to. - Celebrity celebrity = 1; - - // Recognition confidence. Range [0, 1]. - float confidence = 2; -} diff --git a/protos/google/cloud/vision/v1p4beta1/geometry.proto b/protos/google/cloud/vision/v1p4beta1/geometry.proto deleted file mode 100644 index 877fd897..00000000 --- a/protos/google/cloud/vision/v1p4beta1/geometry.proto +++ /dev/null @@ -1,70 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p4beta1; - - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "GeometryProto"; -option java_package = "com.google.cloud.vision.v1p4beta1"; -option objc_class_prefix = "GCVN"; - -// A vertex represents a 2D point in the image. -// NOTE: the vertex coordinates are in the same scale as the original image. -message Vertex { - // X coordinate. - int32 x = 1; - - // Y coordinate. - int32 y = 2; -} - -// 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. -message NormalizedVertex { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; -} - -// A bounding polygon for the detected image annotation. -message BoundingPoly { - // The bounding polygon vertices. - repeated Vertex vertices = 1; - - // The bounding polygon normalized vertices. - repeated NormalizedVertex normalized_vertices = 2; -} - -// 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. -message Position { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; - - // Z coordinate (or depth). - float z = 3; -} diff --git a/protos/google/cloud/vision/v1p4beta1/image_annotator.proto b/protos/google/cloud/vision/v1p4beta1/image_annotator.proto deleted file mode 100644 index cc783697..00000000 --- a/protos/google/cloud/vision/v1p4beta1/image_annotator.proto +++ /dev/null @@ -1,967 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p4beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/vision/v1p4beta1/face.proto"; -import "google/cloud/vision/v1p4beta1/geometry.proto"; -import "google/cloud/vision/v1p4beta1/product_search.proto"; -import "google/cloud/vision/v1p4beta1/text_annotation.proto"; -import "google/cloud/vision/v1p4beta1/web_detection.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/color.proto"; -import "google/type/latlng.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ImageAnnotatorProto"; -option java_package = "com.google.cloud.vision.v1p4beta1"; -option objc_class_prefix = "GCVN"; - -// 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 ImageAnnotator { - option (google.api.default_host) = "vision.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-vision"; - - // Run image detection and annotation for a batch of images. - rpc BatchAnnotateImages(BatchAnnotateImagesRequest) - returns (BatchAnnotateImagesResponse) { - option (google.api.http) = { - post: "/v1p4beta1/images:annotate" - body: "*" - }; - option (google.api.method_signature) = "requests"; - } - - // 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. - rpc BatchAnnotateFiles(BatchAnnotateFilesRequest) - returns (BatchAnnotateFilesResponse) { - option (google.api.http) = { - post: "/v1p4beta1/files:annotate" - body: "*" - }; - option (google.api.method_signature) = "requests"; - } - - // 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. - rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p4beta1/images:asyncBatchAnnotate" - body: "*" - }; - option (google.api.method_signature) = "requests,output_config"; - option (google.longrunning.operation_info) = { - response_type: "AsyncBatchAnnotateImagesResponse" - metadata_type: "OperationMetadata" - }; - } - - // 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). - rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p4beta1/files:asyncBatchAnnotate" - body: "*" - }; - option (google.api.method_signature) = "requests"; - option (google.longrunning.operation_info) = { - response_type: "AsyncBatchAnnotateFilesResponse" - metadata_type: "OperationMetadata" - }; - } -} - -// 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. -message Feature { - // Type of Google Cloud Vision API feature to be extracted. - enum 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; - } - - // The feature type. - Type type = 1; - - // Maximum number of results of this type. Does not apply to - // `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - int32 max_results = 2; - - // Model to use for the feature. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also - // support "builtin/weekly" for the bleeding edge release updated weekly. - string model = 3; -} - -// External image source (Google Cloud Storage or web URL image location). -message ImageSource { - // **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. - string gcs_image_uri = 1; - - // 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. - string image_uri = 2; -} - -// Client image to perform Google Cloud Vision API tasks over. -message Image { - // 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. - bytes content = 1; - - // 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. - ImageSource source = 2; -} - -// A bucketized representation of likelihood, which is intended to give clients -// highly stable results across model upgrades. -enum 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; -} - -// A face annotation object contains the results of face detection. -message FaceAnnotation { - // A face-specific landmark (for example, a face feature). - message Landmark { - // 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 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; - } - - // Face landmark type. - Type type = 3; - - // Face landmark position. - Position position = 4; - } - - // 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. - BoundingPoly bounding_poly = 1; - - // 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. - BoundingPoly fd_bounding_poly = 2; - - // Detected face landmarks. - repeated Landmark landmarks = 3; - - // 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]. - float roll_angle = 4; - - // 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]. - float pan_angle = 5; - - // Pitch angle, which indicates the upwards/downwards angle that the face is - // pointing relative to the image's horizontal plane. Range [-180,180]. - float tilt_angle = 6; - - // Detection confidence. Range [0, 1]. - float detection_confidence = 7; - - // Face landmarking confidence. Range [0, 1]. - float landmarking_confidence = 8; - - // Joy likelihood. - Likelihood joy_likelihood = 9; - - // Sorrow likelihood. - Likelihood sorrow_likelihood = 10; - - // Anger likelihood. - Likelihood anger_likelihood = 11; - - // Surprise likelihood. - Likelihood surprise_likelihood = 12; - - // Under-exposed likelihood. - Likelihood under_exposed_likelihood = 13; - - // Blurred likelihood. - Likelihood blurred_likelihood = 14; - - // Headwear likelihood. - Likelihood headwear_likelihood = 15; - - // Additional recognition information. Only computed if - // image_context.face_recognition_params is provided, **and** a match is found - // to a [Celebrity][google.cloud.vision.v1p4beta1.Celebrity] in the input - // [CelebritySet][google.cloud.vision.v1p4beta1.CelebritySet]. This field is - // sorted in order of decreasing confidence values. - repeated FaceRecognitionResult recognition_result = 16; -} - -// Detected entity location information. -message LocationInfo { - // lat/long location coordinates. - google.type.LatLng lat_lng = 1; -} - -// A `Property` consists of a user-supplied name/value pair. -message Property { - // Name of the property. - string name = 1; - - // Value of the property. - string value = 2; - - // Value of numeric properties. - uint64 uint64_value = 3; -} - -// Set of detected entity features. -message EntityAnnotation { - // Opaque entity ID. Some IDs may be available in - // [Google Knowledge Graph Search - // API](https://developers.google.com/knowledge-graph/). - string mid = 1; - - // The language code for the locale in which the entity textual - // `description` is expressed. - string locale = 2; - - // Entity textual description, expressed in its `locale` language. - string description = 3; - - // Overall score of the result. Range [0, 1]. - float score = 4; - - // **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]. - float confidence = 5 [deprecated = true]; - - // 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]. - float topicality = 6; - - // Image region to which this entity belongs. Not produced - // for `LABEL_DETECTION` features. - BoundingPoly bounding_poly = 7; - - // 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. - repeated LocationInfo locations = 8; - - // Some entities may have optional user-supplied `Property` (name/value) - // fields, such a score or string that qualifies the entity. - repeated Property properties = 9; -} - -// Set of detected objects with bounding boxes. -message LocalizedObjectAnnotation { - // Object ID that should align with EntityAnnotation mid. - string mid = 1; - - // 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. - string language_code = 2; - - // Object name, expressed in its `language_code` language. - string name = 3; - - // Score of the result. Range [0, 1]. - float score = 4; - - // Image region to which this object belongs. This must be populated. - BoundingPoly bounding_poly = 5; -} - -// Set of features pertaining to the image, computed by computer vision -// methods over safe-search verticals (for example, adult, spoof, medical, -// violence). -message SafeSearchAnnotation { - // Represents the adult content likelihood for the image. Adult content may - // contain elements such as nudity, pornographic images or cartoons, or - // sexual activities. - Likelihood adult = 1; - - // Spoof likelihood. The likelihood that an modification - // was made to the image's canonical version to make it appear - // funny or offensive. - Likelihood spoof = 2; - - // Likelihood that this is a medical image. - Likelihood medical = 3; - - // Likelihood that this image contains violent content. - Likelihood violence = 4; - - // 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. - Likelihood racy = 9; -} - -// Rectangle determined by min and max `LatLng` pairs. -message LatLongRect { - // Min lat/long pair. - google.type.LatLng min_lat_lng = 1; - - // Max lat/long pair. - google.type.LatLng max_lat_lng = 2; -} - -// Color information consists of RGB channels, score, and the fraction of -// the image that the color occupies in the image. -message ColorInfo { - // RGB components of the color. - google.type.Color color = 1; - - // Image-specific score for this color. Value in range [0, 1]. - float score = 2; - - // The fraction of pixels the color occupies in the image. - // Value in range [0, 1]. - float pixel_fraction = 3; -} - -// Set of dominant colors and their corresponding scores. -message DominantColorsAnnotation { - // RGB color values with their score and pixel fraction. - repeated ColorInfo colors = 1; -} - -// Stores image properties, such as dominant colors. -message ImageProperties { - // If present, dominant colors completed successfully. - DominantColorsAnnotation dominant_colors = 1; -} - -// Single crop hint that is used to generate a new crop when serving an image. -message CropHint { - // The bounding polygon for the crop region. The coordinates of the bounding - // box are in the original image's scale. - BoundingPoly bounding_poly = 1; - - // Confidence of this being a salient region. Range [0, 1]. - float confidence = 2; - - // Fraction of importance of this salient region with respect to the original - // image. - float importance_fraction = 3; -} - -// Set of crop hints that are used to generate new crops when serving images. -message CropHintsAnnotation { - // Crop hint results. - repeated CropHint crop_hints = 1; -} - -// Parameters for crop hints annotation request. -message CropHintsParams { - // 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. - repeated float aspect_ratios = 1; -} - -// Parameters for web detection request. -message WebDetectionParams { - // Whether to include results derived from the geo information in the image. - bool include_geo_results = 2; -} - -// Parameters for text detections. This is used to control TEXT_DETECTION and -// DOCUMENT_TEXT_DETECTION features. -message TextDetectionParams { - - // By default, Cloud Vision API only includes confidence score for - // DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence - // score for TEXT_DETECTION as well. - bool enable_text_detection_confidence_score = 9; - - // A list of advanced OCR options to fine-tune OCR behavior. - repeated string advanced_ocr_options = 11; -} - -// Image context and/or feature-specific parameters. -message ImageContext { - // Not used. - LatLongRect lat_long_rect = 1; - - // 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). - repeated string language_hints = 2; - - // Parameters for crop hints annotation request. - CropHintsParams crop_hints_params = 4; - - // Parameters for face recognition. - FaceRecognitionParams face_recognition_params = 10; - - // Parameters for product search. - ProductSearchParams product_search_params = 5; - - // Parameters for web detection. - WebDetectionParams web_detection_params = 6; - - // Parameters for text detection and document text detection. - TextDetectionParams text_detection_params = 12; -} - -// Request for performing Google Cloud Vision API tasks over a user-provided -// image, with user-requested features, and with context information. -message AnnotateImageRequest { - // The image to be processed. - Image image = 1; - - // Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image. - ImageContext image_context = 3; -} - -// If an image was produced from a file (e.g. a PDF), this message gives -// information about the source of that image. -message ImageAnnotationContext { - // The URI of the file used to produce the image. - string uri = 1; - - // If the file was a PDF or TIFF, this field gives the page number within - // the file used to produce the image. - int32 page_number = 2; -} - -// Response to an image annotation request. -message AnnotateImageResponse { - // If present, face detection has completed successfully. - repeated FaceAnnotation face_annotations = 1; - - // If present, landmark detection has completed successfully. - repeated EntityAnnotation landmark_annotations = 2; - - // If present, logo detection has completed successfully. - repeated EntityAnnotation logo_annotations = 3; - - // If present, label detection has completed successfully. - repeated EntityAnnotation label_annotations = 4; - - // If present, localized object detection has completed successfully. - // This will be sorted descending by confidence score. - repeated LocalizedObjectAnnotation localized_object_annotations = 22; - - // If present, text (OCR) detection has completed successfully. - repeated EntityAnnotation text_annotations = 5; - - // If present, text (OCR) detection or document (OCR) text detection has - // completed successfully. - // This annotation provides the structural hierarchy for the OCR detected - // text. - TextAnnotation full_text_annotation = 12; - - // If present, safe-search annotation has completed successfully. - SafeSearchAnnotation safe_search_annotation = 6; - - // If present, image properties were extracted successfully. - ImageProperties image_properties_annotation = 8; - - // If present, crop hints have completed successfully. - CropHintsAnnotation crop_hints_annotation = 11; - - // If present, web detection has completed successfully. - WebDetection web_detection = 13; - - // If present, product search has completed successfully. - ProductSearchResults product_search_results = 14; - - // 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. - google.rpc.Status error = 9; - - // If present, contextual information is needed to understand where this image - // comes from. - ImageAnnotationContext context = 21; -} - -// Multiple image annotation requests are batched into a single service call. -message BatchAnnotateImagesRequest { - // Required. Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response to a batch image annotation request. -message BatchAnnotateImagesResponse { - // Individual responses to image annotation requests within the batch. - repeated AnnotateImageResponse responses = 1; -} - -// A request to annotate one single file, e.g. a PDF, TIFF or GIF file. -message AnnotateFileRequest { - // Required. Information about the input file. - InputConfig input_config = 1; - - // Required. Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image(s) in the file. - ImageContext image_context = 3; - - // 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. - repeated int32 pages = 4; -} - -// Response to a single file annotation request. A file may contain one or more -// images, which individually have their own responses. -message AnnotateFileResponse { - // Information about the file for which this response is generated. - InputConfig input_config = 1; - - // Individual responses to images found within the file. This field will be - // empty if the `error` field is set. - repeated AnnotateImageResponse responses = 2; - - // This field gives the total number of pages in the file. - int32 total_pages = 3; - - // If set, represents the error message for the failed request. The - // `responses` field will not be set in this case. - google.rpc.Status error = 4; -} - -// A list of requests to annotate files using the BatchAnnotateFiles API. -message BatchAnnotateFilesRequest { - // Required. The list of file annotation requests. Right now we support only - // one AnnotateFileRequest in BatchAnnotateFilesRequest. - repeated AnnotateFileRequest requests = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// A list of file annotation responses. -message BatchAnnotateFilesResponse { - // The list of file annotation responses, each response corresponding to each - // AnnotateFileRequest in BatchAnnotateFilesRequest. - repeated AnnotateFileResponse responses = 1; -} - -// An offline file annotation request. -message AsyncAnnotateFileRequest { - // Required. Information about the input file. - InputConfig input_config = 1; - - // Required. Requested features. - repeated Feature features = 2; - - // Additional context that may accompany the image(s) in the file. - ImageContext image_context = 3; - - // Required. The desired output location and metadata (e.g. format). - OutputConfig output_config = 4; -} - -// The response for a single offline file annotation request. -message AsyncAnnotateFileResponse { - // The output location and metadata from AsyncAnnotateFileRequest. - OutputConfig output_config = 1; -} - -// Request for async image annotation for a list of images. -message AsyncBatchAnnotateImagesRequest { - // Required. Individual image annotation requests for this batch. - repeated AnnotateImageRequest requests = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The desired output location and metadata (e.g. format). - OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response to an async batch image annotation request. -message AsyncBatchAnnotateImagesResponse { - // The output location and metadata from AsyncBatchAnnotateImagesRequest. - OutputConfig output_config = 1; -} - -// Multiple async file annotation requests are batched into a single service -// call. -message AsyncBatchAnnotateFilesRequest { - // Required. Individual async file annotation requests for this batch. - repeated AsyncAnnotateFileRequest requests = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// Response to an async batch file annotation request. -message AsyncBatchAnnotateFilesResponse { - // The list of file annotation responses, one for each request in - // AsyncBatchAnnotateFilesRequest. - repeated AsyncAnnotateFileResponse responses = 1; -} - -// The desired input location and metadata. -message InputConfig { - // The Google Cloud Storage location to read the input from. - GcsSource gcs_source = 1; - - // 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. - bytes content = 3; - - // The type of the file. Currently only "application/pdf", "image/tiff" and - // "image/gif" are supported. Wildcards are not supported. - string mime_type = 2; -} - -// The desired output location and metadata. -message OutputConfig { - // The Google Cloud Storage location to write the output(s) to. - GcsDestination gcs_destination = 1; - - // 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. - int32 batch_size = 2; -} - -// The Google Cloud Storage location where the input will be read from. -message GcsSource { - // Google Cloud Storage URI for the input file. This must only be a - // Google Cloud Storage object. Wildcards are not currently supported. - string uri = 1; -} - -// The Google Cloud Storage location where the output will be written to. -message GcsDestination { - // 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. - string uri = 1; -} - -// Contains metadata for the BatchAnnotateImages operation. -message OperationMetadata { - // Batch operation states. - enum 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; - } - - // Current state of the batch operation. - State state = 1; - - // The time when the batch request was received. - google.protobuf.Timestamp create_time = 5; - - // The time when the operation result was last updated. - google.protobuf.Timestamp update_time = 6; -} diff --git a/protos/google/cloud/vision/v1p4beta1/product_search.proto b/protos/google/cloud/vision/v1p4beta1/product_search.proto deleted file mode 100644 index ebb428ac..00000000 --- a/protos/google/cloud/vision/v1p4beta1/product_search.proto +++ /dev/null @@ -1,127 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p4beta1; - -import "google/api/resource.proto"; -import "google/cloud/vision/v1p4beta1/geometry.proto"; -import "google/cloud/vision/v1p4beta1/product_search_service.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ProductSearchProto"; -option java_package = "com.google.cloud.vision.v1p4beta1"; -option objc_class_prefix = "GCVN"; - -// Parameters for a product search request. -message ProductSearchParams { - // The bounding polygon around the area of interest in the image. - // If it is not specified, system discretion will be applied. - BoundingPoly bounding_poly = 9; - - // The resource name of a - // [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] to be searched for - // similar images. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - string product_set = 6 [(google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - }]; - - // 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. - repeated string product_categories = 7; - - // 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 '='. - string filter = 8; -} - -// Results for a product search request. -message ProductSearchResults { - // Information about a product. - message Result { - // The Product. - Product product = 1; - - // A confidence level on the match, ranging from 0 (no confidence) to - // 1 (full confidence). - float score = 2; - - // The resource name of the image from the product that is the closest match - // to the query. - string image = 3; - } - - // Prediction for what the object in the bounding box is. - message ObjectAnnotation { - // Object ID that should align with EntityAnnotation mid. - string mid = 1; - - // 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. - string language_code = 2; - - // Object name, expressed in its `language_code` language. - string name = 3; - - // Score of the result. Range [0, 1]. - float score = 4; - } - - // Information about the products similar to a single product in a query - // image. - message GroupedResult { - // The bounding polygon around the product detected in the query image. - BoundingPoly bounding_poly = 1; - - // List of results, one for each product match. - repeated Result results = 2; - - // List of generic predictions for the object in the bounding box. - repeated ObjectAnnotation object_annotations = 3; - } - - // 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. - google.protobuf.Timestamp index_time = 2; - - // List of results, one for each product match. - repeated Result results = 5; - - // 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. - repeated GroupedResult product_grouped_results = 6; -} diff --git a/protos/google/cloud/vision/v1p4beta1/product_search_service.proto b/protos/google/cloud/vision/v1p4beta1/product_search_service.proto deleted file mode 100644 index df7bc7a3..00000000 --- a/protos/google/cloud/vision/v1p4beta1/product_search_service.proto +++ /dev/null @@ -1,1039 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p4beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/vision/v1p4beta1/geometry.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "ProductSearchServiceProto"; -option java_package = "com.google.cloud.vision.v1p4beta1"; -option objc_class_prefix = "GCVN"; - -// 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/*` -service ProductSearch { - option (google.api.default_host) = "vision.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-vision"; - - // Creates and returns a new ProductSet resource. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if display_name is missing, or is longer than - // 4096 characters. - rpc CreateProductSet(CreateProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - post: "/v1p4beta1/{parent=projects/*/locations/*}/productSets" - body: "product_set" - }; - option (google.api.method_signature) = "parent,product_set,product_set_id"; - } - - // Lists ProductSets in an unspecified order. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if page_size is greater than 100, or less - // than 1. - rpc ListProductSets(ListProductSetsRequest) - returns (ListProductSetsResponse) { - option (google.api.http) = { - get: "/v1p4beta1/{parent=projects/*/locations/*}/productSets" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a ProductSet. - // - // Possible errors: - // - // * Returns NOT_FOUND if the ProductSet does not exist. - rpc GetProductSet(GetProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - get: "/v1p4beta1/{name=projects/*/locations/*/productSets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc UpdateProductSet(UpdateProductSetRequest) returns (ProductSet) { - option (google.api.http) = { - patch: "/v1p4beta1/{product_set.name=projects/*/locations/*/productSets/*}" - body: "product_set" - }; - option (google.api.method_signature) = "product_set,update_mask"; - } - - // Permanently deletes a ProductSet. Products and ReferenceImages in the - // ProductSet are not deleted. - // - // The actual image files are not deleted from Google Cloud Storage. - rpc DeleteProductSet(DeleteProductSetRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p4beta1/{name=projects/*/locations/*/productSets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc CreateProduct(CreateProductRequest) returns (Product) { - option (google.api.http) = { - post: "/v1p4beta1/{parent=projects/*/locations/*}/products" - body: "product" - }; - option (google.api.method_signature) = "parent,product,product_id"; - } - - // Lists products in an unspecified order. - // - // Possible errors: - // - // * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) { - option (google.api.http) = { - get: "/v1p4beta1/{parent=projects/*/locations/*}/products" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a Product. - // - // Possible errors: - // - // * Returns NOT_FOUND if the Product does not exist. - rpc GetProduct(GetProductRequest) returns (Product) { - option (google.api.http) = { - get: "/v1p4beta1/{name=projects/*/locations/*/products/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc UpdateProduct(UpdateProductRequest) returns (Product) { - option (google.api.http) = { - patch: "/v1p4beta1/{product.name=projects/*/locations/*/products/*}" - body: "product" - }; - option (google.api.method_signature) = "product,update_mask"; - } - - // 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. - rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p4beta1/{name=projects/*/locations/*/products/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc CreateReferenceImage(CreateReferenceImageRequest) - returns (ReferenceImage) { - option (google.api.http) = { - post: "/v1p4beta1/{parent=projects/*/locations/*/products/*}/referenceImages" - body: "reference_image" - }; - option (google.api.method_signature) = - "parent,reference_image,reference_image_id"; - } - - // 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. - rpc DeleteReferenceImage(DeleteReferenceImageRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p4beta1/{name=projects/*/locations/*/products/*/referenceImages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc ListReferenceImages(ListReferenceImagesRequest) - returns (ListReferenceImagesResponse) { - option (google.api.http) = { - get: "/v1p4beta1/{parent=projects/*/locations/*/products/*}/referenceImages" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets information associated with a ReferenceImage. - // - // Possible errors: - // - // * Returns NOT_FOUND if the specified image does not exist. - rpc GetReferenceImage(GetReferenceImageRequest) returns (ReferenceImage) { - option (google.api.http) = { - get: "/v1p4beta1/{name=projects/*/locations/*/products/*/referenceImages/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc AddProductToProductSet(AddProductToProductSetRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1p4beta1/{name=projects/*/locations/*/productSets/*}:addProduct" - body: "*" - }; - option (google.api.method_signature) = "name,product"; - } - - // Removes a Product from the specified ProductSet. - rpc RemoveProductFromProductSet(RemoveProductFromProductSetRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1p4beta1/{name=projects/*/locations/*/productSets/*}:removeProduct" - body: "*" - }; - option (google.api.method_signature) = "name,product"; - } - - // 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. - rpc ListProductsInProductSet(ListProductsInProductSetRequest) - returns (ListProductsInProductSetResponse) { - option (google.api.http) = { - get: "/v1p4beta1/{name=projects/*/locations/*/productSets/*}/products" - }; - option (google.api.method_signature) = "name"; - } - - // 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]. - rpc ImportProductSets(ImportProductSetsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p4beta1/{parent=projects/*/locations/*}/productSets:import" - body: "*" - }; - option (google.api.method_signature) = "parent,input_config"; - option (google.longrunning.operation_info) = { - response_type: "ImportProductSetsResponse" - metadata_type: "BatchOperationMetadata" - }; - } - - // 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) - rpc PurgeProducts(PurgeProductsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p4beta1/{parent=projects/*/locations/*}/products:purge" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "BatchOperationMetadata" - }; - } -} - -// A Product contains ReferenceImages. -message Product { - option (google.api.resource) = { - type: "vision.googleapis.com/Product" - pattern: "projects/{project}/locations/{location}/products/{product}" - }; - - // A product label represented as a key-value pair. - message KeyValue { - // The key of the label attached to the product. Cannot be empty and cannot - // exceed 128 bytes. - string key = 1; - - // The value of the label attached to the product. Cannot be empty and - // cannot exceed 128 bytes. - string value = 2; - } - - // 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. - string name = 1; - - // The user-provided name for this Product. Must not be empty. Must be at most - // 4096 characters long. - string display_name = 2; - - // User-provided metadata to be stored with this product. Must be at most 4096 - // characters long. - string description = 3; - - // 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. - string product_category = 4 [(google.api.field_behavior) = IMMUTABLE]; - - // 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. - repeated KeyValue product_labels = 5; -} - -// A ProductSet contains Products. A ProductSet can contain a maximum of 1 -// million reference images. If the limit is exceeded, periodic indexing will -// fail. -message ProductSet { - option (google.api.resource) = { - type: "vision.googleapis.com/ProductSet" - pattern: "projects/{project}/locations/{location}/productSets/{product_set}" - }; - - // 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. - string name = 1; - - // The user-provided name for this ProductSet. Must not be empty. Must be at - // most 4096 characters long. - string display_name = 2; - - // 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. - google.protobuf.Timestamp index_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If there was an error with indexing the product set, the field - // is populated. - // - // This field is ignored when creating a ProductSet. - google.rpc.Status index_error = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A `ReferenceImage` represents a product image and its associated metadata, -// such as bounding boxes. -message ReferenceImage { - option (google.api.resource) = { - type: "vision.googleapis.com/ReferenceImage" - pattern: "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}" - }; - - // 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. - string name = 1; - - // Required. The Google Cloud Storage URI of the reference image. - // - // The URI must start with `gs://`. - string uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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). - repeated BoundingPoly bounding_polys = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for the `CreateProduct` method. -message CreateProductRequest { - // Required. The project in which the Product should be created. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The product to create. - Product product = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string product_id = 3; -} - -// Request message for the `ListProducts` method. -message ListProductsRequest { - // Required. The project OR ProductSet from which Products should be listed. - // - // Format: - // `projects/PROJECT_ID/locations/LOC_ID` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProducts` method. -message ListProductsResponse { - // List of products. - repeated Product products = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for the `GetProduct` method. -message GetProductRequest { - // Required. Resource name of the Product to get. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "vision.googleapis.com/Product" } - ]; -} - -// Request message for the `UpdateProduct` method. -message UpdateProductRequest { - // Required. The Product resource which replaces the one on the server. - // product.name is immutable. - Product product = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for the `DeleteProduct` method. -message DeleteProductRequest { - // Required. Resource name of product to delete. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "vision.googleapis.com/Product" } - ]; -} - -// Request message for the `CreateProductSet` method. -message CreateProductSetRequest { - // Required. The project in which the ProductSet should be created. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The ProductSet to create. - ProductSet product_set = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string product_set_id = 3; -} - -// Request message for the `ListProductSets` method. -message ListProductSetsRequest { - // Required. The project from which ProductSets should be listed. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProductSets` method. -message ListProductSetsResponse { - // List of ProductSets. - repeated ProductSet product_sets = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// Request message for the `GetProductSet` method. -message GetProductSetRequest { - // Required. Resource name of the ProductSet to get. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; -} - -// Request message for the `UpdateProductSet` method. -message UpdateProductSetRequest { - // Required. The ProductSet resource which replaces the one on the server. - ProductSet product_set = 1 [(google.api.field_behavior) = REQUIRED]; - - // 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`. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for the `DeleteProductSet` method. -message DeleteProductSetRequest { - // Required. Resource name of the ProductSet to delete. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; -} - -// Request message for the `CreateReferenceImage` method. -message CreateReferenceImageRequest { - // Required. Resource name of the product in which to create the reference - // image. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "vision.googleapis.com/Product" } - ]; - - // Required. The reference image to create. - // If an image ID is specified, it is ignored. - ReferenceImage reference_image = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 `/`. - string reference_image_id = 3; -} - -// Request message for the `ListReferenceImages` method. -message ListReferenceImagesRequest { - // Required. Resource name of the product containing the reference images. - // - // Format is - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "vision.googleapis.com/Product" } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // 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. - string page_token = 3; -} - -// Response message for the `ListReferenceImages` method. -message ListReferenceImagesResponse { - // The list of reference images. - repeated ReferenceImage reference_images = 1; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string next_page_token = 3; -} - -// Request message for the `GetReferenceImage` method. -message GetReferenceImageRequest { - // Required. The resource name of the ReferenceImage to get. - // - // Format is: - // - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ReferenceImage" - } - ]; -} - -// Request message for the `DeleteReferenceImage` method. -message DeleteReferenceImageRequest { - // Required. The resource name of the reference image to delete. - // - // Format is: - // - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ReferenceImage" - } - ]; -} - -// Request message for the `AddProductToProductSet` method. -message AddProductToProductSetRequest { - // Required. The resource name for the ProductSet to modify. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // Required. The resource name for the Product to be added to this ProductSet. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string product = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "vision.googleapis.com/Product" } - ]; -} - -// Request message for the `RemoveProductFromProductSet` method. -message RemoveProductFromProductSetRequest { - // Required. The resource name for the ProductSet to modify. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // Required. The resource name for the Product to be removed from this - // ProductSet. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - string product = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "vision.googleapis.com/Product" } - ]; -} - -// Request message for the `ListProductsInProductSet` method. -message ListProductsInProductSetRequest { - // Required. The ProductSet resource for which to retrieve Products. - // - // Format is: - // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "vision.googleapis.com/ProductSet" - } - ]; - - // The maximum number of items to return. Default 10, maximum 100. - int32 page_size = 2; - - // The next_page_token returned from a previous List request, if any. - string page_token = 3; -} - -// Response message for the `ListProductsInProductSet` method. -message ListProductsInProductSetResponse { - // The list of Products. - repeated Product products = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; -} - -// The Google Cloud Storage location for a csv file which preserves a list of -// ImportProductSetRequests in each line. -message ImportProductSetsGcsSource { - // 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][google.cloud.vision.v1p4beta1.Product.display_name], the - // `product-category` column refers to - // [product_category][google.cloud.vision.v1p4beta1.Product.product_category], - // and the `labels` column refers to - // [product_labels][google.cloud.vision.v1p4beta1.Product.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][google.cloud.vision.v1p4beta1.Product.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). - string csv_file_uri = 1; -} - -// The input content for the `ImportProductSets` method. -message ImportProductSetsInputConfig { - // The source of the input. - oneof source { - // The Google Cloud Storage location for a csv file which preserves a list - // of ImportProductSetRequests in each line. - ImportProductSetsGcsSource gcs_source = 1; - } -} - -// Request message for the `ImportProductSets` method. -message ImportProductSetsRequest { - // Required. The project in which the ProductSets should be imported. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The input content for the list of requests. - ImportProductSetsInputConfig input_config = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for the `ImportProductSets` method. -// -// This message is returned by the -// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] -// method in the returned -// [google.longrunning.Operation.response][google.longrunning.Operation.response] -// field. -message ImportProductSetsResponse { - // The list of reference_images that are imported successfully. - repeated ReferenceImage reference_images = 1; - - // 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. - repeated google.rpc.Status statuses = 2; -} - -// 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. -message BatchOperationMetadata { - // Enumerates the possible states that the batch request can be in. - enum 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; - } - - // The current state of the batch operation. - State state = 1; - - // The time when the batch request was submitted to the server. - google.protobuf.Timestamp submit_time = 2; - - // The time when the batch request is finished and - // [google.longrunning.Operation.done][google.longrunning.Operation.done] is - // set to true. - google.protobuf.Timestamp end_time = 3; -} - -// Config to control which ProductSet contains the Products to be deleted. -message ProductSetPurgeConfig { - // 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. - string product_set_id = 1; -} - -// Request message for the `PurgeProducts` method. -message PurgeProductsRequest { - // The Products to delete. - oneof target { - // Specify which ProductSet contains the Products to be deleted. - ProductSetPurgeConfig product_set_purge_config = 2; - - // If delete_orphan_products is true, all Products that are not in any - // ProductSet will be deleted. - bool delete_orphan_products = 3; - } - - // Required. The project and location in which the Products should be deleted. - // - // Format is `projects/PROJECT_ID/locations/LOC_ID`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The default value is false. Override this value to true to actually perform - // the purge. - bool force = 4; -} diff --git a/protos/google/cloud/vision/v1p4beta1/text_annotation.proto b/protos/google/cloud/vision/v1p4beta1/text_annotation.proto deleted file mode 100644 index 233c4c68..00000000 --- a/protos/google/cloud/vision/v1p4beta1/text_annotation.proto +++ /dev/null @@ -1,260 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p4beta1; - -import "google/cloud/vision/v1p4beta1/geometry.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "TextAnnotationProto"; -option java_package = "com.google.cloud.vision.v1p4beta1"; -option objc_class_prefix = "GCVN"; - -// 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][google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty] -// message definition below for more detail. -message TextAnnotation { - // Detected language for a structural component. - message DetectedLanguage { - // The BCP-47 language code, such as "en-US" or "sr-Latn". For more - // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - string language_code = 1; - - // Confidence of detected language. Range [0, 1]. - float confidence = 2; - } - - // Detected start or end of a structural component. - message DetectedBreak { - // Enum to denote the type of break found. New line, space etc. - enum 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; - } - - // Detected break type. - BreakType type = 1; - - // True if break prepends the element. - bool is_prefix = 2; - } - - // Additional information detected on the structural component. - message TextProperty { - // A list of detected languages together with confidence. - repeated DetectedLanguage detected_languages = 1; - - // Detected start or end of a text segment. - DetectedBreak detected_break = 2; - } - - // List of pages detected by OCR. - repeated Page pages = 1; - - // UTF-8 text detected on the pages. - string text = 2; -} - -// Detected page from OCR. -message Page { - // Additional information detected on the page. - TextAnnotation.TextProperty property = 1; - - // Page width. For PDFs the unit is points. For images (including - // TIFFs) the unit is pixels. - int32 width = 2; - - // Page height. For PDFs the unit is points. For images (including - // TIFFs) the unit is pixels. - int32 height = 3; - - // List of blocks of text, images etc on this page. - repeated Block blocks = 4; - - // Confidence of the OCR results on the page. Range [0, 1]. - float confidence = 5; -} - -// Logical element on the page. -message Block { - // Type of a block (text, image etc) as identified by OCR. - enum 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; - } - - // Additional information detected for the block. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of paragraphs in this block (if this blocks is of type text). - repeated Paragraph paragraphs = 3; - - // Detected block type (text, image etc) for this block. - BlockType block_type = 4; - - // Confidence of the OCR results on the block. Range [0, 1]. - float confidence = 5; -} - -// Structural unit of text representing a number of words in certain order. -message Paragraph { - // Additional information detected for the paragraph. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of all words in this paragraph. - repeated Word words = 3; - - // Confidence of the OCR results for the paragraph. Range [0, 1]. - float confidence = 4; -} - -// A word representation. -message Word { - // Additional information detected for the word. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // List of symbols in the word. - // The order of the symbols follows the natural reading order. - repeated Symbol symbols = 3; - - // Confidence of the OCR results for the word. Range [0, 1]. - float confidence = 4; -} - -// A single symbol representation. -message Symbol { - // Additional information detected for the symbol. - TextAnnotation.TextProperty property = 1; - - // 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). - BoundingPoly bounding_box = 2; - - // The actual UTF-8 representation of the symbol. - string text = 3; - - // Confidence of the OCR results for the symbol. Range [0, 1]. - float confidence = 4; -} diff --git a/protos/google/cloud/vision/v1p4beta1/web_detection.proto b/protos/google/cloud/vision/v1p4beta1/web_detection.proto deleted file mode 100644 index 7d716570..00000000 --- a/protos/google/cloud/vision/v1p4beta1/web_detection.proto +++ /dev/null @@ -1,106 +0,0 @@ -// 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. -// - -syntax = "proto3"; - -package google.cloud.vision.v1p4beta1; - - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision"; -option java_multiple_files = true; -option java_outer_classname = "WebDetectionProto"; -option java_package = "com.google.cloud.vision.v1p4beta1"; -option objc_class_prefix = "GCVN"; - -// Relevant information for the image from the Internet. -message WebDetection { - // Entity deduced from similar images on the Internet. - message WebEntity { - // Opaque entity ID. - string entity_id = 1; - - // Overall relevancy score for the entity. - // Not normalized and not comparable across different image queries. - float score = 2; - - // Canonical description of the entity, in English. - string description = 3; - } - - // Metadata for online images. - message WebImage { - // The result image URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the image. - float score = 2; - } - - // Metadata for web pages. - message WebPage { - // The result web page URL. - string url = 1; - - // (Deprecated) Overall relevancy score for the web page. - float score = 2; - - // Title for the web page, may contain HTML markups. - string page_title = 3; - - // Fully matching images on the page. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 4; - - // 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. - repeated WebImage partial_matching_images = 5; - } - - // Label to provide extra metadata for the web detection. - message WebLabel { - // Label for extra metadata. - string label = 1; - - // 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. - string language_code = 2; - } - - // Deduced entities from similar images on the Internet. - repeated WebEntity web_entities = 1; - - // Fully matching images from the Internet. - // Can include resized copies of the query image. - repeated WebImage full_matching_images = 2; - - // 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. - repeated WebImage partial_matching_images = 3; - - // Web pages containing the matching images from the Internet. - repeated WebPage pages_with_matching_images = 4; - - // The visually similar image results. - repeated WebImage visually_similar_images = 6; - - // The service's best guess as to the topic of the request image. - // Inferred from similar images on the open web. - repeated WebLabel best_guess_labels = 8; -} diff --git a/protos/protos.d.ts b/protos/protos.d.ts deleted file mode 100644 index 9beac75e..00000000 --- a/protos/protos.d.ts +++ /dev/null @@ -1,49404 +0,0 @@ -// Copyright 2023 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. - -import type {protobuf as $protobuf} from "google-gax"; -import Long = require("long"); -/** Namespace google. */ -export namespace google { - - /** Namespace cloud. */ - namespace cloud { - - /** Namespace vision. */ - namespace vision { - - /** 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 }; - - /** - * Gets the default type url for Vertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for NormalizedVertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for BoundingPoly - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for Position - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** - * 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; - - /** - * 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.v1.IBatchAnnotateImagesRequest, callback: google.cloud.vision.v1.ImageAnnotator.BatchAnnotateImagesCallback): void; - - /** - * Calls BatchAnnotateImages. - * @param request BatchAnnotateImagesRequest message or plain object - * @returns Promise - */ - public batchAnnotateImages(request: google.cloud.vision.v1.IBatchAnnotateImagesRequest): Promise; - - /** - * 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.v1.IBatchAnnotateFilesRequest, callback: google.cloud.vision.v1.ImageAnnotator.BatchAnnotateFilesCallback): void; - - /** - * Calls BatchAnnotateFiles. - * @param request BatchAnnotateFilesRequest message or plain object - * @returns Promise - */ - public batchAnnotateFiles(request: google.cloud.vision.v1.IBatchAnnotateFilesRequest): Promise; - - /** - * Calls AsyncBatchAnnotateImages. - * @param request AsyncBatchAnnotateImagesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public asyncBatchAnnotateImages(request: google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest, callback: google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateImagesCallback): void; - - /** - * Calls AsyncBatchAnnotateImages. - * @param request AsyncBatchAnnotateImagesRequest message or plain object - * @returns Promise - */ - public asyncBatchAnnotateImages(request: google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest): Promise; - - /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest, callback: google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateFilesCallback): void; - - /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @returns Promise - */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest): Promise; - } - - namespace ImageAnnotator { - - /** - * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator|batchAnnotateImages}. - * @param error Error, if any - * @param [response] BatchAnnotateImagesResponse - */ - type BatchAnnotateImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1.BatchAnnotateImagesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator|batchAnnotateFiles}. - * @param error Error, if any - * @param [response] BatchAnnotateFilesResponse - */ - type BatchAnnotateFilesCallback = (error: (Error|null), response?: google.cloud.vision.v1.BatchAnnotateFilesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator|asyncBatchAnnotateImages}. - * @param error Error, if any - * @param [response] Operation - */ - type AsyncBatchAnnotateImagesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator|asyncBatchAnnotateFiles}. - * @param error Error, if any - * @param [response] Operation - */ - type AsyncBatchAnnotateFilesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Likelihood enum. */ - enum Likelihood { - UNKNOWN = 0, - VERY_UNLIKELY = 1, - UNLIKELY = 2, - POSSIBLE = 3, - LIKELY = 4, - VERY_LIKELY = 5 - } - - /** Properties of a Feature. */ - interface IFeature { - - /** Feature type */ - type?: (google.cloud.vision.v1.Feature.Type|keyof typeof google.cloud.vision.v1.Feature.Type|null); - - /** Feature maxResults */ - maxResults?: (number|null); - - /** Feature model */ - model?: (string|null); - } - - /** Represents a Feature. */ - class Feature implements IFeature { - - /** - * Constructs a new Feature. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IFeature); - - /** Feature type. */ - public type: (google.cloud.vision.v1.Feature.Type|keyof typeof google.cloud.vision.v1.Feature.Type); - - /** Feature maxResults. */ - public maxResults: number; - - /** Feature model. */ - public model: string; - - /** - * Creates a new Feature instance using the specified properties. - * @param [properties] Properties to set - * @returns Feature instance - */ - public static create(properties?: google.cloud.vision.v1.IFeature): google.cloud.vision.v1.Feature; - - /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.Feature; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.Feature; - - /** - * 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 Feature message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Feature - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Feature; - - /** - * 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.v1.Feature, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Feature to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Feature - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 { - - /** ImageSource gcsImageUri */ - gcsImageUri?: (string|null); - - /** ImageSource imageUri */ - imageUri?: (string|null); - } - - /** Represents an ImageSource. */ - class ImageSource implements IImageSource { - - /** - * Constructs a new ImageSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImageSource); - - /** ImageSource gcsImageUri. */ - public gcsImageUri: string; - - /** ImageSource imageUri. */ - public imageUri: string; - - /** - * Creates a new ImageSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageSource instance - */ - public static create(properties?: google.cloud.vision.v1.IImageSource): google.cloud.vision.v1.ImageSource; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.ImageSource; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.ImageSource; - - /** - * 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 an ImageSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ImageSource; - - /** - * 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.v1.ImageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Image. */ - interface IImage { - - /** Image content */ - content?: (Uint8Array|string|null); - - /** Image source */ - source?: (google.cloud.vision.v1.IImageSource|null); - } - - /** Represents an Image. */ - class Image implements IImage { - - /** - * Constructs a new Image. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImage); - - /** Image content. */ - public content: (Uint8Array|string); - - /** Image source. */ - public source?: (google.cloud.vision.v1.IImageSource|null); - - /** - * Creates a new Image instance using the specified properties. - * @param [properties] Properties to set - * @returns Image instance - */ - public static create(properties?: google.cloud.vision.v1.IImage): google.cloud.vision.v1.Image; - - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.Image; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.Image; - - /** - * 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 an Image message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Image - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Image; - - /** - * 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.v1.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Image to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Image - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FaceAnnotation. */ - interface IFaceAnnotation { - - /** FaceAnnotation boundingPoly */ - boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly */ - fdBoundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** FaceAnnotation landmarks */ - landmarks?: (google.cloud.vision.v1.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.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** FaceAnnotation sorrowLikelihood */ - sorrowLikelihood?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** FaceAnnotation angerLikelihood */ - angerLikelihood?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** FaceAnnotation surpriseLikelihood */ - surpriseLikelihood?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** FaceAnnotation underExposedLikelihood */ - underExposedLikelihood?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** FaceAnnotation blurredLikelihood */ - blurredLikelihood?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** FaceAnnotation headwearLikelihood */ - headwearLikelihood?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - } - - /** Represents a FaceAnnotation. */ - class FaceAnnotation implements IFaceAnnotation { - - /** - * Constructs a new FaceAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IFaceAnnotation); - - /** FaceAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly. */ - public fdBoundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** FaceAnnotation landmarks. */ - public landmarks: google.cloud.vision.v1.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.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** FaceAnnotation sorrowLikelihood. */ - public sorrowLikelihood: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** FaceAnnotation angerLikelihood. */ - public angerLikelihood: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** FaceAnnotation surpriseLikelihood. */ - public surpriseLikelihood: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** FaceAnnotation underExposedLikelihood. */ - public underExposedLikelihood: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** FaceAnnotation blurredLikelihood. */ - public blurredLikelihood: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** FaceAnnotation headwearLikelihood. */ - public headwearLikelihood: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** - * Creates a new FaceAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns FaceAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1.IFaceAnnotation): google.cloud.vision.v1.FaceAnnotation; - - /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.FaceAnnotation; - - /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.FaceAnnotation; - - /** - * 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 FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FaceAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.FaceAnnotation; - - /** - * 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.v1.FaceAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FaceAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FaceAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FaceAnnotation { - - /** Properties of a Landmark. */ - interface ILandmark { - - /** Landmark type */ - type?: (google.cloud.vision.v1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1.FaceAnnotation.Landmark.Type|null); - - /** Landmark position */ - position?: (google.cloud.vision.v1.IPosition|null); - } - - /** Represents a Landmark. */ - class Landmark implements ILandmark { - - /** - * Constructs a new Landmark. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.FaceAnnotation.ILandmark); - - /** Landmark type. */ - public type: (google.cloud.vision.v1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1.FaceAnnotation.Landmark.Type); - - /** Landmark position. */ - public position?: (google.cloud.vision.v1.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.v1.FaceAnnotation.ILandmark): google.cloud.vision.v1.FaceAnnotation.Landmark; - - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1.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.v1.FaceAnnotation.ILandmark, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.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.v1.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.v1.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.v1.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.v1.FaceAnnotation.Landmark, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Landmark to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Landmark - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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, - LEFT_CHEEK_CENTER = 35, - RIGHT_CHEEK_CENTER = 36 - } - } - } - - /** Properties of a LocationInfo. */ - interface ILocationInfo { - - /** LocationInfo latLng */ - latLng?: (google.type.ILatLng|null); - } - - /** Represents a LocationInfo. */ - class LocationInfo implements ILocationInfo { - - /** - * Constructs a new LocationInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ILocationInfo); - - /** LocationInfo latLng. */ - public latLng?: (google.type.ILatLng|null); - - /** - * Creates a new LocationInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns LocationInfo instance - */ - public static create(properties?: google.cloud.vision.v1.ILocationInfo): google.cloud.vision.v1.LocationInfo; - - /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1.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.v1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LocationInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1.LocationInfo; - - /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1.LocationInfo; - - /** - * Verifies a LocationInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocationInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.LocationInfo; - - /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @param message LocationInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocationInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocationInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Property. */ - interface IProperty { - - /** Property name */ - name?: (string|null); - - /** Property value */ - value?: (string|null); - - /** Property uint64Value */ - uint64Value?: (number|Long|string|null); - } - - /** Represents a Property. */ - class Property implements IProperty { - - /** - * Constructs a new Property. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IProperty); - - /** Property name. */ - public name: string; - - /** Property value. */ - public value: string; - - /** Property uint64Value. */ - public uint64Value: (number|Long|string); - - /** - * Creates a new Property instance using the specified properties. - * @param [properties] Properties to set - * @returns Property instance - */ - public static create(properties?: google.cloud.vision.v1.IProperty): google.cloud.vision.v1.Property; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Property message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1.Property; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1.Property; - - /** - * Verifies a Property message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Property - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Property; - - /** - * 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.v1.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Property to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Property - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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.v1.IBoundingPoly|null); - - /** EntityAnnotation locations */ - locations?: (google.cloud.vision.v1.ILocationInfo[]|null); - - /** EntityAnnotation properties */ - properties?: (google.cloud.vision.v1.IProperty[]|null); - } - - /** Represents an EntityAnnotation. */ - class EntityAnnotation implements IEntityAnnotation { - - /** - * Constructs a new EntityAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.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; - - /** EntityAnnotation topicality. */ - public topicality: number; - - /** EntityAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** EntityAnnotation locations. */ - public locations: google.cloud.vision.v1.ILocationInfo[]; - - /** EntityAnnotation properties. */ - public properties: google.cloud.vision.v1.IProperty[]; - - /** - * Creates a new EntityAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns EntityAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1.IEntityAnnotation): google.cloud.vision.v1.EntityAnnotation; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1.EntityAnnotation; - - /** - * 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 - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1.EntityAnnotation; - - /** - * 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 an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EntityAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.EntityAnnotation; - - /** - * 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.v1.EntityAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EntityAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EntityAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LocalizedObjectAnnotation. */ - interface ILocalizedObjectAnnotation { - - /** 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.v1.IBoundingPoly|null); - } - - /** Represents a LocalizedObjectAnnotation. */ - class LocalizedObjectAnnotation implements ILocalizedObjectAnnotation { - - /** - * Constructs a new LocalizedObjectAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ILocalizedObjectAnnotation); - - /** 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.v1.IBoundingPoly|null); - - /** - * Creates a new LocalizedObjectAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns LocalizedObjectAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1.ILocalizedObjectAnnotation): google.cloud.vision.v1.LocalizedObjectAnnotation; - - /** - * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1.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.v1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.LocalizedObjectAnnotation; - - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.LocalizedObjectAnnotation; - - /** - * 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 LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocalizedObjectAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.LocalizedObjectAnnotation; - - /** - * 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.v1.LocalizedObjectAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocalizedObjectAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocalizedObjectAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SafeSearchAnnotation. */ - interface ISafeSearchAnnotation { - - /** SafeSearchAnnotation adult */ - adult?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** SafeSearchAnnotation spoof */ - spoof?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** SafeSearchAnnotation medical */ - medical?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** SafeSearchAnnotation violence */ - violence?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - - /** SafeSearchAnnotation racy */ - racy?: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood|null); - } - - /** Represents a SafeSearchAnnotation. */ - class SafeSearchAnnotation implements ISafeSearchAnnotation { - - /** - * Constructs a new SafeSearchAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ISafeSearchAnnotation); - - /** SafeSearchAnnotation adult. */ - public adult: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** SafeSearchAnnotation spoof. */ - public spoof: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** SafeSearchAnnotation medical. */ - public medical: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** SafeSearchAnnotation violence. */ - public violence: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** SafeSearchAnnotation racy. */ - public racy: (google.cloud.vision.v1.Likelihood|keyof typeof google.cloud.vision.v1.Likelihood); - - /** - * Creates a new SafeSearchAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns SafeSearchAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1.ISafeSearchAnnotation): google.cloud.vision.v1.SafeSearchAnnotation; - - /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1.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.v1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.SafeSearchAnnotation; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.SafeSearchAnnotation; - - /** - * 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 SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SafeSearchAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.SafeSearchAnnotation; - - /** - * 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.v1.SafeSearchAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LatLongRect. */ - interface ILatLongRect { - - /** LatLongRect minLatLng */ - minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng */ - maxLatLng?: (google.type.ILatLng|null); - } - - /** Represents a LatLongRect. */ - class LatLongRect implements ILatLongRect { - - /** - * Constructs a new LatLongRect. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ILatLongRect); - - /** LatLongRect minLatLng. */ - public minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng. */ - public maxLatLng?: (google.type.ILatLng|null); - - /** - * Creates a new LatLongRect instance using the specified properties. - * @param [properties] Properties to set - * @returns LatLongRect instance - */ - public static create(properties?: google.cloud.vision.v1.ILatLongRect): google.cloud.vision.v1.LatLongRect; - - /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1.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.v1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.LatLongRect; - - /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.LatLongRect; - - /** - * 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 LatLongRect message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LatLongRect - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.LatLongRect; - - /** - * 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.v1.LatLongRect, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LatLongRect to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LatLongRect - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ColorInfo. */ - interface IColorInfo { - - /** ColorInfo color */ - color?: (google.type.IColor|null); - - /** ColorInfo score */ - score?: (number|null); - - /** ColorInfo pixelFraction */ - pixelFraction?: (number|null); - } - - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { - - /** - * Constructs a new ColorInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IColorInfo); - - /** ColorInfo color. */ - public color?: (google.type.IColor|null); - - /** ColorInfo score. */ - public score: number; - - /** ColorInfo pixelFraction. */ - public pixelFraction: number; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns ColorInfo instance - */ - public static create(properties?: google.cloud.vision.v1.IColorInfo): google.cloud.vision.v1.ColorInfo; - - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.ColorInfo; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.ColorInfo; - - /** - * 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 a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ColorInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ColorInfo; - - /** - * 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.v1.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ColorInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ColorInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DominantColorsAnnotation. */ - interface IDominantColorsAnnotation { - - /** DominantColorsAnnotation colors */ - colors?: (google.cloud.vision.v1.IColorInfo[]|null); - } - - /** Represents a DominantColorsAnnotation. */ - class DominantColorsAnnotation implements IDominantColorsAnnotation { - - /** - * Constructs a new DominantColorsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IDominantColorsAnnotation); - - /** DominantColorsAnnotation colors. */ - public colors: google.cloud.vision.v1.IColorInfo[]; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns DominantColorsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1.IDominantColorsAnnotation): google.cloud.vision.v1.DominantColorsAnnotation; - - /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.DominantColorsAnnotation; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.DominantColorsAnnotation; - - /** - * 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 a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DominantColorsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.DominantColorsAnnotation; - - /** - * 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.v1.DominantColorsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageProperties. */ - interface IImageProperties { - - /** ImageProperties dominantColors */ - dominantColors?: (google.cloud.vision.v1.IDominantColorsAnnotation|null); - } - - /** Represents an ImageProperties. */ - class ImageProperties implements IImageProperties { - - /** - * Constructs a new ImageProperties. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImageProperties); - - /** ImageProperties dominantColors. */ - public dominantColors?: (google.cloud.vision.v1.IDominantColorsAnnotation|null); - - /** - * Creates a new ImageProperties instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageProperties instance - */ - public static create(properties?: google.cloud.vision.v1.IImageProperties): google.cloud.vision.v1.ImageProperties; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 ImageProperties - * @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.ImageProperties; - - /** - * 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.v1.ImageProperties; - - /** - * Verifies an ImageProperties 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. - * @param object Plain object - * @returns ImageProperties - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ImageProperties; - - /** - * 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.v1.ImageProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageProperties to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageProperties - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHint. */ - interface ICropHint { - - /** CropHint boundingPoly */ - boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** CropHint confidence */ - confidence?: (number|null); - - /** CropHint importanceFraction */ - importanceFraction?: (number|null); - } - - /** Represents a CropHint. */ - class CropHint implements ICropHint { - - /** - * Constructs a new CropHint. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ICropHint); - - /** CropHint boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** CropHint confidence. */ - public confidence: number; - - /** CropHint importanceFraction. */ - public importanceFraction: number; - - /** - * Creates a new CropHint instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHint instance - */ - public static create(properties?: google.cloud.vision.v1.ICropHint): google.cloud.vision.v1.CropHint; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1.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.v1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.CropHint; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.CropHint; - - /** - * 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 a CropHint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHint - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.CropHint; - - /** - * 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.v1.CropHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsAnnotation. */ - interface ICropHintsAnnotation { - - /** CropHintsAnnotation cropHints */ - cropHints?: (google.cloud.vision.v1.ICropHint[]|null); - } - - /** Represents a CropHintsAnnotation. */ - class CropHintsAnnotation implements ICropHintsAnnotation { - - /** - * Constructs a new CropHintsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ICropHintsAnnotation); - - /** CropHintsAnnotation cropHints. */ - public cropHints: google.cloud.vision.v1.ICropHint[]; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1.ICropHintsAnnotation): google.cloud.vision.v1.CropHintsAnnotation; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1.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.v1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.CropHintsAnnotation; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.CropHintsAnnotation; - - /** - * 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 CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.CropHintsAnnotation; - - /** - * 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.v1.CropHintsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsParams. */ - interface ICropHintsParams { - - /** CropHintsParams aspectRatios */ - aspectRatios?: (number[]|null); - } - - /** Represents a CropHintsParams. */ - class CropHintsParams implements ICropHintsParams { - - /** - * Constructs a new CropHintsParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ICropHintsParams); - - /** CropHintsParams aspectRatios. */ - public aspectRatios: number[]; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsParams instance - */ - public static create(properties?: google.cloud.vision.v1.ICropHintsParams): google.cloud.vision.v1.CropHintsParams; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1.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.v1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.CropHintsParams; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.CropHintsParams; - - /** - * 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 CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.CropHintsParams; - - /** - * 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.v1.CropHintsParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetectionParams. */ - interface IWebDetectionParams { - - /** WebDetectionParams includeGeoResults */ - includeGeoResults?: (boolean|null); - } - - /** Represents a WebDetectionParams. */ - class WebDetectionParams implements IWebDetectionParams { - - /** - * Constructs a new WebDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IWebDetectionParams); - - /** WebDetectionParams includeGeoResults. */ - public includeGeoResults: boolean; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1.IWebDetectionParams): google.cloud.vision.v1.WebDetectionParams; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.WebDetectionParams; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.WebDetectionParams; - - /** - * 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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.WebDetectionParams; - - /** - * 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.v1.WebDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TextDetectionParams. */ - interface ITextDetectionParams { - - /** TextDetectionParams enableTextDetectionConfidenceScore */ - enableTextDetectionConfidenceScore?: (boolean|null); - - /** TextDetectionParams advancedOcrOptions */ - advancedOcrOptions?: (string[]|null); - } - - /** Represents a TextDetectionParams. */ - class TextDetectionParams implements ITextDetectionParams { - - /** - * Constructs a new TextDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ITextDetectionParams); - - /** TextDetectionParams enableTextDetectionConfidenceScore. */ - public enableTextDetectionConfidenceScore: boolean; - - /** TextDetectionParams advancedOcrOptions. */ - public advancedOcrOptions: string[]; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns TextDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1.ITextDetectionParams): google.cloud.vision.v1.TextDetectionParams; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Verifies a TextDetectionParams 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 TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.TextDetectionParams; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @param message TextDetectionParams - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.TextDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageContext. */ - interface IImageContext { - - /** ImageContext latLongRect */ - latLongRect?: (google.cloud.vision.v1.ILatLongRect|null); - - /** ImageContext languageHints */ - languageHints?: (string[]|null); - - /** ImageContext cropHintsParams */ - cropHintsParams?: (google.cloud.vision.v1.ICropHintsParams|null); - - /** ImageContext productSearchParams */ - productSearchParams?: (google.cloud.vision.v1.IProductSearchParams|null); - - /** ImageContext webDetectionParams */ - webDetectionParams?: (google.cloud.vision.v1.IWebDetectionParams|null); - - /** ImageContext textDetectionParams */ - textDetectionParams?: (google.cloud.vision.v1.ITextDetectionParams|null); - } - - /** Represents an ImageContext. */ - class ImageContext implements IImageContext { - - /** - * Constructs a new ImageContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImageContext); - - /** ImageContext latLongRect. */ - public latLongRect?: (google.cloud.vision.v1.ILatLongRect|null); - - /** ImageContext languageHints. */ - public languageHints: string[]; - - /** ImageContext cropHintsParams. */ - public cropHintsParams?: (google.cloud.vision.v1.ICropHintsParams|null); - - /** ImageContext productSearchParams. */ - public productSearchParams?: (google.cloud.vision.v1.IProductSearchParams|null); - - /** ImageContext webDetectionParams. */ - public webDetectionParams?: (google.cloud.vision.v1.IWebDetectionParams|null); - - /** ImageContext textDetectionParams. */ - public textDetectionParams?: (google.cloud.vision.v1.ITextDetectionParams|null); - - /** - * Creates a new ImageContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageContext instance - */ - public static create(properties?: google.cloud.vision.v1.IImageContext): google.cloud.vision.v1.ImageContext; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.ImageContext; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.ImageContext; - - /** - * 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 ImageContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ImageContext; - - /** - * 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.v1.ImageContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageRequest. */ - interface IAnnotateImageRequest { - - /** AnnotateImageRequest image */ - image?: (google.cloud.vision.v1.IImage|null); - - /** AnnotateImageRequest features */ - features?: (google.cloud.vision.v1.IFeature[]|null); - - /** AnnotateImageRequest imageContext */ - imageContext?: (google.cloud.vision.v1.IImageContext|null); - } - - /** Represents an AnnotateImageRequest. */ - class AnnotateImageRequest implements IAnnotateImageRequest { - - /** - * Constructs a new AnnotateImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAnnotateImageRequest); - - /** AnnotateImageRequest image. */ - public image?: (google.cloud.vision.v1.IImage|null); - - /** AnnotateImageRequest features. */ - public features: google.cloud.vision.v1.IFeature[]; - - /** AnnotateImageRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1.IImageContext|null); - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IAnnotateImageRequest): google.cloud.vision.v1.AnnotateImageRequest; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AnnotateImageRequest; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AnnotateImageRequest; - - /** - * 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 an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AnnotateImageRequest; - - /** - * 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.v1.AnnotateImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageAnnotationContext. */ - interface IImageAnnotationContext { - - /** ImageAnnotationContext uri */ - uri?: (string|null); - - /** ImageAnnotationContext pageNumber */ - pageNumber?: (number|null); - } - - /** Represents an ImageAnnotationContext. */ - class ImageAnnotationContext implements IImageAnnotationContext { - - /** - * Constructs a new ImageAnnotationContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImageAnnotationContext); - - /** ImageAnnotationContext uri. */ - public uri: string; - - /** ImageAnnotationContext pageNumber. */ - public pageNumber: number; - - /** - * Creates a new ImageAnnotationContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageAnnotationContext instance - */ - public static create(properties?: google.cloud.vision.v1.IImageAnnotationContext): google.cloud.vision.v1.ImageAnnotationContext; - - /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.ImageAnnotationContext; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.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.v1.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.v1.ImageAnnotationContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageAnnotationContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageAnnotationContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageResponse. */ - interface IAnnotateImageResponse { - - /** AnnotateImageResponse faceAnnotations */ - faceAnnotations?: (google.cloud.vision.v1.IFaceAnnotation[]|null); - - /** AnnotateImageResponse landmarkAnnotations */ - landmarkAnnotations?: (google.cloud.vision.v1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse logoAnnotations */ - logoAnnotations?: (google.cloud.vision.v1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse labelAnnotations */ - labelAnnotations?: (google.cloud.vision.v1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse localizedObjectAnnotations */ - localizedObjectAnnotations?: (google.cloud.vision.v1.ILocalizedObjectAnnotation[]|null); - - /** AnnotateImageResponse textAnnotations */ - textAnnotations?: (google.cloud.vision.v1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse fullTextAnnotation */ - fullTextAnnotation?: (google.cloud.vision.v1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation */ - safeSearchAnnotation?: (google.cloud.vision.v1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation */ - imagePropertiesAnnotation?: (google.cloud.vision.v1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation */ - cropHintsAnnotation?: (google.cloud.vision.v1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection */ - webDetection?: (google.cloud.vision.v1.IWebDetection|null); - - /** AnnotateImageResponse productSearchResults */ - productSearchResults?: (google.cloud.vision.v1.IProductSearchResults|null); - - /** AnnotateImageResponse error */ - error?: (google.rpc.IStatus|null); - - /** AnnotateImageResponse context */ - context?: (google.cloud.vision.v1.IImageAnnotationContext|null); - } - - /** Represents an AnnotateImageResponse. */ - class AnnotateImageResponse implements IAnnotateImageResponse { - - /** - * Constructs a new AnnotateImageResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAnnotateImageResponse); - - /** AnnotateImageResponse faceAnnotations. */ - public faceAnnotations: google.cloud.vision.v1.IFaceAnnotation[]; - - /** AnnotateImageResponse landmarkAnnotations. */ - public landmarkAnnotations: google.cloud.vision.v1.IEntityAnnotation[]; - - /** AnnotateImageResponse logoAnnotations. */ - public logoAnnotations: google.cloud.vision.v1.IEntityAnnotation[]; - - /** AnnotateImageResponse labelAnnotations. */ - public labelAnnotations: google.cloud.vision.v1.IEntityAnnotation[]; - - /** AnnotateImageResponse localizedObjectAnnotations. */ - public localizedObjectAnnotations: google.cloud.vision.v1.ILocalizedObjectAnnotation[]; - - /** AnnotateImageResponse textAnnotations. */ - public textAnnotations: google.cloud.vision.v1.IEntityAnnotation[]; - - /** AnnotateImageResponse fullTextAnnotation. */ - public fullTextAnnotation?: (google.cloud.vision.v1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation. */ - public safeSearchAnnotation?: (google.cloud.vision.v1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation. */ - public imagePropertiesAnnotation?: (google.cloud.vision.v1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation. */ - public cropHintsAnnotation?: (google.cloud.vision.v1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection. */ - public webDetection?: (google.cloud.vision.v1.IWebDetection|null); - - /** AnnotateImageResponse productSearchResults. */ - public productSearchResults?: (google.cloud.vision.v1.IProductSearchResults|null); - - /** AnnotateImageResponse error. */ - public error?: (google.rpc.IStatus|null); - - /** AnnotateImageResponse context. */ - public context?: (google.cloud.vision.v1.IImageAnnotationContext|null); - - /** - * Creates a new AnnotateImageResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IAnnotateImageResponse): google.cloud.vision.v1.AnnotateImageResponse; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AnnotateImageResponse; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AnnotateImageResponse; - - /** - * 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 AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AnnotateImageResponse; - - /** - * 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.v1.AnnotateImageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesRequest. */ - interface IBatchAnnotateImagesRequest { - - /** BatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1.IAnnotateImageRequest[]|null); - - /** BatchAnnotateImagesRequest parent */ - parent?: (string|null); - } - - /** Represents a BatchAnnotateImagesRequest. */ - class BatchAnnotateImagesRequest implements IBatchAnnotateImagesRequest { - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IBatchAnnotateImagesRequest); - - /** BatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1.IAnnotateImageRequest[]; - - /** BatchAnnotateImagesRequest parent. */ - public parent: string; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IBatchAnnotateImagesRequest): google.cloud.vision.v1.BatchAnnotateImagesRequest; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.BatchAnnotateImagesRequest; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.BatchAnnotateImagesRequest; - - /** - * 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 a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.BatchAnnotateImagesRequest; - - /** - * 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.v1.BatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesResponse. */ - interface IBatchAnnotateImagesResponse { - - /** BatchAnnotateImagesResponse responses */ - responses?: (google.cloud.vision.v1.IAnnotateImageResponse[]|null); - } - - /** Represents a BatchAnnotateImagesResponse. */ - class BatchAnnotateImagesResponse implements IBatchAnnotateImagesResponse { - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IBatchAnnotateImagesResponse); - - /** BatchAnnotateImagesResponse responses. */ - public responses: google.cloud.vision.v1.IAnnotateImageResponse[]; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IBatchAnnotateImagesResponse): google.cloud.vision.v1.BatchAnnotateImagesResponse; - - /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.BatchAnnotateImagesResponse; - - /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.BatchAnnotateImagesResponse; - - /** - * 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 a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.BatchAnnotateImagesResponse; - - /** - * 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.v1.BatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateFileRequest. */ - interface IAnnotateFileRequest { - - /** AnnotateFileRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1.IInputConfig|null); - - /** AnnotateFileRequest features */ - features?: (google.cloud.vision.v1.IFeature[]|null); - - /** AnnotateFileRequest imageContext */ - imageContext?: (google.cloud.vision.v1.IImageContext|null); - - /** AnnotateFileRequest pages */ - pages?: (number[]|null); - } - - /** Represents an AnnotateFileRequest. */ - class AnnotateFileRequest implements IAnnotateFileRequest { - - /** - * Constructs a new AnnotateFileRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAnnotateFileRequest); - - /** AnnotateFileRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1.IInputConfig|null); - - /** AnnotateFileRequest features. */ - public features: google.cloud.vision.v1.IFeature[]; - - /** AnnotateFileRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1.IImageContext|null); - - /** AnnotateFileRequest pages. */ - public pages: number[]; - - /** - * Creates a new AnnotateFileRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateFileRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IAnnotateFileRequest): google.cloud.vision.v1.AnnotateFileRequest; - - /** - * Encodes the specified AnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AnnotateFileRequest; - - /** - * Decodes an AnnotateFileRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AnnotateFileRequest; - - /** - * 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 AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateFileRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AnnotateFileRequest; - - /** - * 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.v1.AnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateFileRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateFileRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateFileResponse. */ - interface IAnnotateFileResponse { - - /** AnnotateFileResponse inputConfig */ - inputConfig?: (google.cloud.vision.v1.IInputConfig|null); - - /** AnnotateFileResponse responses */ - responses?: (google.cloud.vision.v1.IAnnotateImageResponse[]|null); - - /** AnnotateFileResponse totalPages */ - totalPages?: (number|null); - - /** AnnotateFileResponse error */ - error?: (google.rpc.IStatus|null); - } - - /** Represents an AnnotateFileResponse. */ - class AnnotateFileResponse implements IAnnotateFileResponse { - - /** - * Constructs a new AnnotateFileResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAnnotateFileResponse); - - /** AnnotateFileResponse inputConfig. */ - public inputConfig?: (google.cloud.vision.v1.IInputConfig|null); - - /** AnnotateFileResponse responses. */ - public responses: google.cloud.vision.v1.IAnnotateImageResponse[]; - - /** AnnotateFileResponse totalPages. */ - public totalPages: number; - - /** AnnotateFileResponse error. */ - public error?: (google.rpc.IStatus|null); - - /** - * Creates a new AnnotateFileResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateFileResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IAnnotateFileResponse): google.cloud.vision.v1.AnnotateFileResponse; - - /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AnnotateFileResponse; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AnnotateFileResponse; - - /** - * 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 AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateFileResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AnnotateFileResponse; - - /** - * 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.v1.AnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateFileResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateFileResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateFilesRequest. */ - interface IBatchAnnotateFilesRequest { - - /** BatchAnnotateFilesRequest requests */ - requests?: (google.cloud.vision.v1.IAnnotateFileRequest[]|null); - - /** BatchAnnotateFilesRequest parent */ - parent?: (string|null); - } - - /** Represents a BatchAnnotateFilesRequest. */ - class BatchAnnotateFilesRequest implements IBatchAnnotateFilesRequest { - - /** - * Constructs a new BatchAnnotateFilesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IBatchAnnotateFilesRequest); - - /** BatchAnnotateFilesRequest requests. */ - public requests: google.cloud.vision.v1.IAnnotateFileRequest[]; - - /** BatchAnnotateFilesRequest parent. */ - public parent: string; - - /** - * Creates a new BatchAnnotateFilesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateFilesRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IBatchAnnotateFilesRequest): google.cloud.vision.v1.BatchAnnotateFilesRequest; - - /** - * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.BatchAnnotateFilesRequest; - - /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.BatchAnnotateFilesRequest; - - /** - * 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 a BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateFilesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.BatchAnnotateFilesRequest; - - /** - * 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.v1.BatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateFilesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateFilesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateFilesResponse. */ - interface IBatchAnnotateFilesResponse { - - /** BatchAnnotateFilesResponse responses */ - responses?: (google.cloud.vision.v1.IAnnotateFileResponse[]|null); - } - - /** Represents a BatchAnnotateFilesResponse. */ - class BatchAnnotateFilesResponse implements IBatchAnnotateFilesResponse { - - /** - * Constructs a new BatchAnnotateFilesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IBatchAnnotateFilesResponse); - - /** BatchAnnotateFilesResponse responses. */ - public responses: google.cloud.vision.v1.IAnnotateFileResponse[]; - - /** - * Creates a new BatchAnnotateFilesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateFilesResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IBatchAnnotateFilesResponse): google.cloud.vision.v1.BatchAnnotateFilesResponse; - - /** - * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.BatchAnnotateFilesResponse; - - /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.BatchAnnotateFilesResponse; - - /** - * 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 a BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateFilesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.BatchAnnotateFilesResponse; - - /** - * 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.v1.BatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateFilesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateFilesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncAnnotateFileRequest. */ - interface IAsyncAnnotateFileRequest { - - /** AsyncAnnotateFileRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1.IInputConfig|null); - - /** AsyncAnnotateFileRequest features */ - features?: (google.cloud.vision.v1.IFeature[]|null); - - /** AsyncAnnotateFileRequest imageContext */ - imageContext?: (google.cloud.vision.v1.IImageContext|null); - - /** AsyncAnnotateFileRequest outputConfig */ - outputConfig?: (google.cloud.vision.v1.IOutputConfig|null); - } - - /** Represents an AsyncAnnotateFileRequest. */ - class AsyncAnnotateFileRequest implements IAsyncAnnotateFileRequest { - - /** - * Constructs a new AsyncAnnotateFileRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAsyncAnnotateFileRequest); - - /** AsyncAnnotateFileRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1.IInputConfig|null); - - /** AsyncAnnotateFileRequest features. */ - public features: google.cloud.vision.v1.IFeature[]; - - /** AsyncAnnotateFileRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1.IImageContext|null); - - /** AsyncAnnotateFileRequest outputConfig. */ - public outputConfig?: (google.cloud.vision.v1.IOutputConfig|null); - - /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncAnnotateFileRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IAsyncAnnotateFileRequest): google.cloud.vision.v1.AsyncAnnotateFileRequest; - - /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AsyncAnnotateFileRequest; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AsyncAnnotateFileRequest; - - /** - * 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 AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncAnnotateFileRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AsyncAnnotateFileRequest; - - /** - * 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.v1.AsyncAnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncAnnotateFileRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncAnnotateFileRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncAnnotateFileResponse. */ - interface IAsyncAnnotateFileResponse { - - /** AsyncAnnotateFileResponse outputConfig */ - outputConfig?: (google.cloud.vision.v1.IOutputConfig|null); - } - - /** Represents an AsyncAnnotateFileResponse. */ - class AsyncAnnotateFileResponse implements IAsyncAnnotateFileResponse { - - /** - * Constructs a new AsyncAnnotateFileResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAsyncAnnotateFileResponse); - - /** AsyncAnnotateFileResponse outputConfig. */ - public outputConfig?: (google.cloud.vision.v1.IOutputConfig|null); - - /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncAnnotateFileResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IAsyncAnnotateFileResponse): google.cloud.vision.v1.AsyncAnnotateFileResponse; - - /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AsyncAnnotateFileResponse; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AsyncAnnotateFileResponse; - - /** - * 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 an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncAnnotateFileResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AsyncAnnotateFileResponse; - - /** - * 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.v1.AsyncAnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncAnnotateFileResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncAnnotateFileResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateImagesRequest. */ - interface IAsyncBatchAnnotateImagesRequest { - - /** AsyncBatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1.IAnnotateImageRequest[]|null); - - /** AsyncBatchAnnotateImagesRequest outputConfig */ - outputConfig?: (google.cloud.vision.v1.IOutputConfig|null); - - /** AsyncBatchAnnotateImagesRequest parent */ - parent?: (string|null); - } - - /** Represents an AsyncBatchAnnotateImagesRequest. */ - class AsyncBatchAnnotateImagesRequest implements IAsyncBatchAnnotateImagesRequest { - - /** - * Constructs a new AsyncBatchAnnotateImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest); - - /** AsyncBatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1.IAnnotateImageRequest[]; - - /** AsyncBatchAnnotateImagesRequest outputConfig. */ - public outputConfig?: (google.cloud.vision.v1.IOutputConfig|null); - - /** AsyncBatchAnnotateImagesRequest parent. */ - public parent: string; - - /** - * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest): google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest; - - /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AsyncBatchAnnotateImagesRequest; - - /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AsyncBatchAnnotateImagesRequest; - - /** - * 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 an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest; - - /** - * 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.v1.AsyncBatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateImagesResponse. */ - interface IAsyncBatchAnnotateImagesResponse { - - /** AsyncBatchAnnotateImagesResponse outputConfig */ - outputConfig?: (google.cloud.vision.v1.IOutputConfig|null); - } - - /** Represents an AsyncBatchAnnotateImagesResponse. */ - class AsyncBatchAnnotateImagesResponse implements IAsyncBatchAnnotateImagesResponse { - - /** - * Constructs a new AsyncBatchAnnotateImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse); - - /** AsyncBatchAnnotateImagesResponse outputConfig. */ - public outputConfig?: (google.cloud.vision.v1.IOutputConfig|null); - - /** - * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse): google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse; - - /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AsyncBatchAnnotateImagesResponse; - - /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AsyncBatchAnnotateImagesResponse; - - /** - * 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 AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse; - - /** - * 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.v1.AsyncBatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateFilesRequest. */ - interface IAsyncBatchAnnotateFilesRequest { - - /** AsyncBatchAnnotateFilesRequest requests */ - requests?: (google.cloud.vision.v1.IAsyncAnnotateFileRequest[]|null); - - /** AsyncBatchAnnotateFilesRequest parent */ - parent?: (string|null); - } - - /** Represents an AsyncBatchAnnotateFilesRequest. */ - class AsyncBatchAnnotateFilesRequest implements IAsyncBatchAnnotateFilesRequest { - - /** - * Constructs a new AsyncBatchAnnotateFilesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest); - - /** AsyncBatchAnnotateFilesRequest requests. */ - public requests: google.cloud.vision.v1.IAsyncAnnotateFileRequest[]; - - /** AsyncBatchAnnotateFilesRequest parent. */ - public parent: string; - - /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest): google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AsyncBatchAnnotateFilesRequest; - - /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AsyncBatchAnnotateFilesRequest; - - /** - * 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 an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateFilesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest; - - /** - * 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.v1.AsyncBatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateFilesResponse. */ - interface IAsyncBatchAnnotateFilesResponse { - - /** AsyncBatchAnnotateFilesResponse responses */ - responses?: (google.cloud.vision.v1.IAsyncAnnotateFileResponse[]|null); - } - - /** Represents an AsyncBatchAnnotateFilesResponse. */ - class AsyncBatchAnnotateFilesResponse implements IAsyncBatchAnnotateFilesResponse { - - /** - * Constructs a new AsyncBatchAnnotateFilesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse); - - /** AsyncBatchAnnotateFilesResponse responses. */ - public responses: google.cloud.vision.v1.IAsyncAnnotateFileResponse[]; - - /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse): google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.AsyncBatchAnnotateFilesResponse; - - /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.AsyncBatchAnnotateFilesResponse; - - /** - * 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 an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateFilesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse; - - /** - * 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.v1.AsyncBatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InputConfig. */ - interface IInputConfig { - - /** InputConfig gcsSource */ - gcsSource?: (google.cloud.vision.v1.IGcsSource|null); - - /** InputConfig content */ - content?: (Uint8Array|string|null); - - /** InputConfig mimeType */ - mimeType?: (string|null); - } - - /** Represents an InputConfig. */ - class InputConfig implements IInputConfig { - - /** - * Constructs a new InputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IInputConfig); - - /** InputConfig gcsSource. */ - public gcsSource?: (google.cloud.vision.v1.IGcsSource|null); - - /** InputConfig content. */ - public content: (Uint8Array|string); - - /** InputConfig mimeType. */ - public mimeType: string; - - /** - * Creates a new InputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns InputConfig instance - */ - public static create(properties?: google.cloud.vision.v1.IInputConfig): google.cloud.vision.v1.InputConfig; - - /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.InputConfig; - - /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.InputConfig; - - /** - * 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 an InputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.InputConfig; - - /** - * 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.v1.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OutputConfig. */ - interface IOutputConfig { - - /** OutputConfig gcsDestination */ - gcsDestination?: (google.cloud.vision.v1.IGcsDestination|null); - - /** OutputConfig batchSize */ - batchSize?: (number|null); - } - - /** Represents an OutputConfig. */ - class OutputConfig implements IOutputConfig { - - /** - * Constructs a new OutputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IOutputConfig); - - /** OutputConfig gcsDestination. */ - public gcsDestination?: (google.cloud.vision.v1.IGcsDestination|null); - - /** OutputConfig batchSize. */ - public batchSize: number; - - /** - * Creates a new OutputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns OutputConfig instance - */ - public static create(properties?: google.cloud.vision.v1.IOutputConfig): google.cloud.vision.v1.OutputConfig; - - /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.OutputConfig; - - /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.OutputConfig; - - /** - * 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 an OutputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OutputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.OutputConfig; - - /** - * 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.v1.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OutputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OutputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GcsSource. */ - interface IGcsSource { - - /** GcsSource uri */ - uri?: (string|null); - } - - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { - - /** - * Constructs a new GcsSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IGcsSource); - - /** GcsSource uri. */ - public uri: string; - - /** - * Creates a new GcsSource instance using the specified properties. - * @param [properties] Properties to set - * @returns GcsSource instance - */ - public static create(properties?: google.cloud.vision.v1.IGcsSource): google.cloud.vision.v1.GcsSource; - - /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.GcsSource; - - /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.GcsSource; - - /** - * 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 GcsSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GcsSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.GcsSource; - - /** - * 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.v1.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GcsSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GcsSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GcsDestination. */ - interface IGcsDestination { - - /** GcsDestination uri */ - uri?: (string|null); - } - - /** Represents a GcsDestination. */ - class GcsDestination implements IGcsDestination { - - /** - * Constructs a new GcsDestination. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IGcsDestination); - - /** GcsDestination uri. */ - public uri: string; - - /** - * Creates a new GcsDestination instance using the specified properties. - * @param [properties] Properties to set - * @returns GcsDestination instance - */ - public static create(properties?: google.cloud.vision.v1.IGcsDestination): google.cloud.vision.v1.GcsDestination; - - /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.GcsDestination; - - /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.GcsDestination; - - /** - * 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 GcsDestination message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GcsDestination - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.GcsDestination; - - /** - * 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.v1.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GcsDestination to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GcsDestination - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OperationMetadata. */ - interface IOperationMetadata { - - /** OperationMetadata state */ - state?: (google.cloud.vision.v1.OperationMetadata.State|keyof typeof google.cloud.vision.v1.OperationMetadata.State|null); - - /** OperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents an OperationMetadata. */ - class OperationMetadata implements IOperationMetadata { - - /** - * Constructs a new OperationMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IOperationMetadata); - - /** OperationMetadata state. */ - public state: (google.cloud.vision.v1.OperationMetadata.State|keyof typeof google.cloud.vision.v1.OperationMetadata.State); - - /** OperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationMetadata instance - */ - public static create(properties?: google.cloud.vision.v1.IOperationMetadata): google.cloud.vision.v1.OperationMetadata; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1.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.v1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1.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.v1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1.OperationMetadata; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1.OperationMetadata; - - /** - * 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 an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.OperationMetadata; - - /** - * 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.v1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace OperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - CREATED = 1, - RUNNING = 2, - DONE = 3, - CANCELLED = 4 - } - } - - /** Properties of a ProductSearchParams. */ - interface IProductSearchParams { - - /** ProductSearchParams boundingPoly */ - boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** ProductSearchParams productSet */ - productSet?: (string|null); - - /** ProductSearchParams productCategories */ - productCategories?: (string[]|null); - - /** ProductSearchParams filter */ - filter?: (string|null); - } - - /** Represents a ProductSearchParams. */ - class ProductSearchParams implements IProductSearchParams { - - /** - * Constructs a new ProductSearchParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IProductSearchParams); - - /** ProductSearchParams boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** ProductSearchParams productSet. */ - public productSet: string; - - /** ProductSearchParams productCategories. */ - public productCategories: string[]; - - /** ProductSearchParams filter. */ - public filter: string; - - /** - * Creates a new ProductSearchParams instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSearchParams instance - */ - public static create(properties?: google.cloud.vision.v1.IProductSearchParams): google.cloud.vision.v1.ProductSearchParams; - - /** - * Encodes the specified ProductSearchParams message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchParams.verify|verify} messages. - * @param message ProductSearchParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IProductSearchParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSearchParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchParams.verify|verify} messages. - * @param message ProductSearchParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IProductSearchParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSearchParams - * @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.ProductSearchParams; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSearchParams - * @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.ProductSearchParams; - - /** - * Verifies a ProductSearchParams 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 ProductSearchParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSearchParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ProductSearchParams; - - /** - * Creates a plain object from a ProductSearchParams message. Also converts values to other types if specified. - * @param message ProductSearchParams - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ProductSearchParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSearchParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSearchParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ProductSearchResults. */ - interface IProductSearchResults { - - /** ProductSearchResults indexTime */ - indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSearchResults results */ - results?: (google.cloud.vision.v1.ProductSearchResults.IResult[]|null); - - /** ProductSearchResults productGroupedResults */ - productGroupedResults?: (google.cloud.vision.v1.ProductSearchResults.IGroupedResult[]|null); - } - - /** Represents a ProductSearchResults. */ - class ProductSearchResults implements IProductSearchResults { - - /** - * Constructs a new ProductSearchResults. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IProductSearchResults); - - /** ProductSearchResults indexTime. */ - public indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSearchResults results. */ - public results: google.cloud.vision.v1.ProductSearchResults.IResult[]; - - /** ProductSearchResults productGroupedResults. */ - public productGroupedResults: google.cloud.vision.v1.ProductSearchResults.IGroupedResult[]; - - /** - * Creates a new ProductSearchResults instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSearchResults instance - */ - public static create(properties?: google.cloud.vision.v1.IProductSearchResults): google.cloud.vision.v1.ProductSearchResults; - - /** - * Encodes the specified ProductSearchResults message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.verify|verify} messages. - * @param message ProductSearchResults message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IProductSearchResults, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSearchResults message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.verify|verify} messages. - * @param message ProductSearchResults message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IProductSearchResults, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSearchResults - * @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.ProductSearchResults; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSearchResults - * @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.ProductSearchResults; - - /** - * Verifies a ProductSearchResults 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 ProductSearchResults message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSearchResults - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ProductSearchResults; - - /** - * Creates a plain object from a ProductSearchResults message. Also converts values to other types if specified. - * @param message ProductSearchResults - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ProductSearchResults, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSearchResults to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSearchResults - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ProductSearchResults { - - /** Properties of a Result. */ - interface IResult { - - /** Result product */ - product?: (google.cloud.vision.v1.IProduct|null); - - /** Result score */ - score?: (number|null); - - /** Result image */ - image?: (string|null); - } - - /** Represents a Result. */ - class Result implements IResult { - - /** - * Constructs a new Result. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ProductSearchResults.IResult); - - /** Result product. */ - public product?: (google.cloud.vision.v1.IProduct|null); - - /** Result score. */ - public score: number; - - /** Result image. */ - public image: string; - - /** - * Creates a new Result instance using the specified properties. - * @param [properties] Properties to set - * @returns Result instance - */ - public static create(properties?: google.cloud.vision.v1.ProductSearchResults.IResult): google.cloud.vision.v1.ProductSearchResults.Result; - - /** - * Encodes the specified Result message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.Result.verify|verify} messages. - * @param message Result message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ProductSearchResults.IResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Result message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.Result.verify|verify} messages. - * @param message Result message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ProductSearchResults.IResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Result message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Result - * @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.ProductSearchResults.Result; - - /** - * Decodes a Result message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Result - * @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.ProductSearchResults.Result; - - /** - * Verifies a Result 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 Result message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Result - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ProductSearchResults.Result; - - /** - * Creates a plain object from a Result message. Also converts values to other types if specified. - * @param message Result - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ProductSearchResults.Result, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Result to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Result - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ObjectAnnotation. */ - interface IObjectAnnotation { - - /** ObjectAnnotation mid */ - mid?: (string|null); - - /** ObjectAnnotation languageCode */ - languageCode?: (string|null); - - /** ObjectAnnotation name */ - name?: (string|null); - - /** ObjectAnnotation score */ - score?: (number|null); - } - - /** Represents an ObjectAnnotation. */ - class ObjectAnnotation implements IObjectAnnotation { - - /** - * Constructs a new ObjectAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation); - - /** ObjectAnnotation mid. */ - public mid: string; - - /** ObjectAnnotation languageCode. */ - public languageCode: string; - - /** ObjectAnnotation name. */ - public name: string; - - /** ObjectAnnotation score. */ - public score: number; - - /** - * Creates a new ObjectAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns ObjectAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation): google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation; - - /** - * Encodes the specified ObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @param message ObjectAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @param message ObjectAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation; - - /** - * Verifies an ObjectAnnotation 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 ObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ObjectAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation; - - /** - * Creates a plain object from an ObjectAnnotation message. Also converts values to other types if specified. - * @param message ObjectAnnotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ObjectAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ObjectAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GroupedResult. */ - interface IGroupedResult { - - /** GroupedResult boundingPoly */ - boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** GroupedResult results */ - results?: (google.cloud.vision.v1.ProductSearchResults.IResult[]|null); - - /** GroupedResult objectAnnotations */ - objectAnnotations?: (google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation[]|null); - } - - /** Represents a GroupedResult. */ - class GroupedResult implements IGroupedResult { - - /** - * Constructs a new GroupedResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ProductSearchResults.IGroupedResult); - - /** GroupedResult boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** GroupedResult results. */ - public results: google.cloud.vision.v1.ProductSearchResults.IResult[]; - - /** GroupedResult objectAnnotations. */ - public objectAnnotations: google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation[]; - - /** - * Creates a new GroupedResult instance using the specified properties. - * @param [properties] Properties to set - * @returns GroupedResult instance - */ - public static create(properties?: google.cloud.vision.v1.ProductSearchResults.IGroupedResult): google.cloud.vision.v1.ProductSearchResults.GroupedResult; - - /** - * Encodes the specified GroupedResult message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @param message GroupedResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ProductSearchResults.IGroupedResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GroupedResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @param message GroupedResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ProductSearchResults.IGroupedResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GroupedResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GroupedResult - * @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.ProductSearchResults.GroupedResult; - - /** - * Decodes a GroupedResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GroupedResult - * @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.ProductSearchResults.GroupedResult; - - /** - * Verifies a GroupedResult 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 GroupedResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GroupedResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ProductSearchResults.GroupedResult; - - /** - * Creates a plain object from a GroupedResult message. Also converts values to other types if specified. - * @param message GroupedResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ProductSearchResults.GroupedResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GroupedResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GroupedResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Represents a ProductSearch */ - class ProductSearch extends $protobuf.rpc.Service { - - /** - * Constructs a new ProductSearch 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); - - /** - * Creates new ProductSearch 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): ProductSearch; - - /** - * Calls CreateProductSet. - * @param request CreateProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public createProductSet(request: google.cloud.vision.v1.ICreateProductSetRequest, callback: google.cloud.vision.v1.ProductSearch.CreateProductSetCallback): void; - - /** - * Calls CreateProductSet. - * @param request CreateProductSetRequest message or plain object - * @returns Promise - */ - public createProductSet(request: google.cloud.vision.v1.ICreateProductSetRequest): Promise; - - /** - * Calls ListProductSets. - * @param request ListProductSetsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductSetsResponse - */ - public listProductSets(request: google.cloud.vision.v1.IListProductSetsRequest, callback: google.cloud.vision.v1.ProductSearch.ListProductSetsCallback): void; - - /** - * Calls ListProductSets. - * @param request ListProductSetsRequest message or plain object - * @returns Promise - */ - public listProductSets(request: google.cloud.vision.v1.IListProductSetsRequest): Promise; - - /** - * Calls GetProductSet. - * @param request GetProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public getProductSet(request: google.cloud.vision.v1.IGetProductSetRequest, callback: google.cloud.vision.v1.ProductSearch.GetProductSetCallback): void; - - /** - * Calls GetProductSet. - * @param request GetProductSetRequest message or plain object - * @returns Promise - */ - public getProductSet(request: google.cloud.vision.v1.IGetProductSetRequest): Promise; - - /** - * Calls UpdateProductSet. - * @param request UpdateProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public updateProductSet(request: google.cloud.vision.v1.IUpdateProductSetRequest, callback: google.cloud.vision.v1.ProductSearch.UpdateProductSetCallback): void; - - /** - * Calls UpdateProductSet. - * @param request UpdateProductSetRequest message or plain object - * @returns Promise - */ - public updateProductSet(request: google.cloud.vision.v1.IUpdateProductSetRequest): Promise; - - /** - * Calls DeleteProductSet. - * @param request DeleteProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteProductSet(request: google.cloud.vision.v1.IDeleteProductSetRequest, callback: google.cloud.vision.v1.ProductSearch.DeleteProductSetCallback): void; - - /** - * Calls DeleteProductSet. - * @param request DeleteProductSetRequest message or plain object - * @returns Promise - */ - public deleteProductSet(request: google.cloud.vision.v1.IDeleteProductSetRequest): Promise; - - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public createProduct(request: google.cloud.vision.v1.ICreateProductRequest, callback: google.cloud.vision.v1.ProductSearch.CreateProductCallback): void; - - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise - */ - public createProduct(request: google.cloud.vision.v1.ICreateProductRequest): Promise; - - /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsResponse - */ - public listProducts(request: google.cloud.vision.v1.IListProductsRequest, callback: google.cloud.vision.v1.ProductSearch.ListProductsCallback): void; - - /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @returns Promise - */ - public listProducts(request: google.cloud.vision.v1.IListProductsRequest): Promise; - - /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public getProduct(request: google.cloud.vision.v1.IGetProductRequest, callback: google.cloud.vision.v1.ProductSearch.GetProductCallback): void; - - /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise - */ - public getProduct(request: google.cloud.vision.v1.IGetProductRequest): Promise; - - /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public updateProduct(request: google.cloud.vision.v1.IUpdateProductRequest, callback: google.cloud.vision.v1.ProductSearch.UpdateProductCallback): void; - - /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise - */ - public updateProduct(request: google.cloud.vision.v1.IUpdateProductRequest): Promise; - - /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteProduct(request: google.cloud.vision.v1.IDeleteProductRequest, callback: google.cloud.vision.v1.ProductSearch.DeleteProductCallback): void; - - /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise - */ - public deleteProduct(request: google.cloud.vision.v1.IDeleteProductRequest): Promise; - - /** - * Calls CreateReferenceImage. - * @param request CreateReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ReferenceImage - */ - public createReferenceImage(request: google.cloud.vision.v1.ICreateReferenceImageRequest, callback: google.cloud.vision.v1.ProductSearch.CreateReferenceImageCallback): void; - - /** - * Calls CreateReferenceImage. - * @param request CreateReferenceImageRequest message or plain object - * @returns Promise - */ - public createReferenceImage(request: google.cloud.vision.v1.ICreateReferenceImageRequest): Promise; - - /** - * Calls DeleteReferenceImage. - * @param request DeleteReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteReferenceImage(request: google.cloud.vision.v1.IDeleteReferenceImageRequest, callback: google.cloud.vision.v1.ProductSearch.DeleteReferenceImageCallback): void; - - /** - * Calls DeleteReferenceImage. - * @param request DeleteReferenceImageRequest message or plain object - * @returns Promise - */ - public deleteReferenceImage(request: google.cloud.vision.v1.IDeleteReferenceImageRequest): Promise; - - /** - * Calls ListReferenceImages. - * @param request ListReferenceImagesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListReferenceImagesResponse - */ - public listReferenceImages(request: google.cloud.vision.v1.IListReferenceImagesRequest, callback: google.cloud.vision.v1.ProductSearch.ListReferenceImagesCallback): void; - - /** - * Calls ListReferenceImages. - * @param request ListReferenceImagesRequest message or plain object - * @returns Promise - */ - public listReferenceImages(request: google.cloud.vision.v1.IListReferenceImagesRequest): Promise; - - /** - * Calls GetReferenceImage. - * @param request GetReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ReferenceImage - */ - public getReferenceImage(request: google.cloud.vision.v1.IGetReferenceImageRequest, callback: google.cloud.vision.v1.ProductSearch.GetReferenceImageCallback): void; - - /** - * Calls GetReferenceImage. - * @param request GetReferenceImageRequest message or plain object - * @returns Promise - */ - public getReferenceImage(request: google.cloud.vision.v1.IGetReferenceImageRequest): Promise; - - /** - * Calls AddProductToProductSet. - * @param request AddProductToProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public addProductToProductSet(request: google.cloud.vision.v1.IAddProductToProductSetRequest, callback: google.cloud.vision.v1.ProductSearch.AddProductToProductSetCallback): void; - - /** - * Calls AddProductToProductSet. - * @param request AddProductToProductSetRequest message or plain object - * @returns Promise - */ - public addProductToProductSet(request: google.cloud.vision.v1.IAddProductToProductSetRequest): Promise; - - /** - * Calls RemoveProductFromProductSet. - * @param request RemoveProductFromProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public removeProductFromProductSet(request: google.cloud.vision.v1.IRemoveProductFromProductSetRequest, callback: google.cloud.vision.v1.ProductSearch.RemoveProductFromProductSetCallback): void; - - /** - * Calls RemoveProductFromProductSet. - * @param request RemoveProductFromProductSetRequest message or plain object - * @returns Promise - */ - public removeProductFromProductSet(request: google.cloud.vision.v1.IRemoveProductFromProductSetRequest): Promise; - - /** - * Calls ListProductsInProductSet. - * @param request ListProductsInProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsInProductSetResponse - */ - public listProductsInProductSet(request: google.cloud.vision.v1.IListProductsInProductSetRequest, callback: google.cloud.vision.v1.ProductSearch.ListProductsInProductSetCallback): void; - - /** - * Calls ListProductsInProductSet. - * @param request ListProductsInProductSetRequest message or plain object - * @returns Promise - */ - public listProductsInProductSet(request: google.cloud.vision.v1.IListProductsInProductSetRequest): Promise; - - /** - * Calls ImportProductSets. - * @param request ImportProductSetsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public importProductSets(request: google.cloud.vision.v1.IImportProductSetsRequest, callback: google.cloud.vision.v1.ProductSearch.ImportProductSetsCallback): void; - - /** - * Calls ImportProductSets. - * @param request ImportProductSetsRequest message or plain object - * @returns Promise - */ - public importProductSets(request: google.cloud.vision.v1.IImportProductSetsRequest): Promise; - - /** - * Calls PurgeProducts. - * @param request PurgeProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public purgeProducts(request: google.cloud.vision.v1.IPurgeProductsRequest, callback: google.cloud.vision.v1.ProductSearch.PurgeProductsCallback): void; - - /** - * Calls PurgeProducts. - * @param request PurgeProductsRequest message or plain object - * @returns Promise - */ - public purgeProducts(request: google.cloud.vision.v1.IPurgeProductsRequest): Promise; - } - - namespace ProductSearch { - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|createProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type CreateProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|listProductSets}. - * @param error Error, if any - * @param [response] ListProductSetsResponse - */ - type ListProductSetsCallback = (error: (Error|null), response?: google.cloud.vision.v1.ListProductSetsResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|getProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type GetProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|updateProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type UpdateProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|deleteProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|createProduct}. - * @param error Error, if any - * @param [response] Product - */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.vision.v1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|listProducts}. - * @param error Error, if any - * @param [response] ListProductsResponse - */ - type ListProductsCallback = (error: (Error|null), response?: google.cloud.vision.v1.ListProductsResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|getProduct}. - * @param error Error, if any - * @param [response] Product - */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.vision.v1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|updateProduct}. - * @param error Error, if any - * @param [response] Product - */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.vision.v1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|deleteProduct}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|createReferenceImage}. - * @param error Error, if any - * @param [response] ReferenceImage - */ - type CreateReferenceImageCallback = (error: (Error|null), response?: google.cloud.vision.v1.ReferenceImage) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|deleteReferenceImage}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteReferenceImageCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|listReferenceImages}. - * @param error Error, if any - * @param [response] ListReferenceImagesResponse - */ - type ListReferenceImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1.ListReferenceImagesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|getReferenceImage}. - * @param error Error, if any - * @param [response] ReferenceImage - */ - type GetReferenceImageCallback = (error: (Error|null), response?: google.cloud.vision.v1.ReferenceImage) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|addProductToProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type AddProductToProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|removeProductFromProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type RemoveProductFromProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|listProductsInProductSet}. - * @param error Error, if any - * @param [response] ListProductsInProductSetResponse - */ - type ListProductsInProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1.ListProductsInProductSetResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|importProductSets}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportProductSetsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|purgeProducts}. - * @param error Error, if any - * @param [response] Operation - */ - type PurgeProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a Product. */ - interface IProduct { - - /** Product name */ - name?: (string|null); - - /** Product displayName */ - displayName?: (string|null); - - /** Product description */ - description?: (string|null); - - /** Product productCategory */ - productCategory?: (string|null); - - /** Product productLabels */ - productLabels?: (google.cloud.vision.v1.Product.IKeyValue[]|null); - } - - /** Represents a Product. */ - class Product implements IProduct { - - /** - * Constructs a new Product. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IProduct); - - /** Product name. */ - public name: string; - - /** Product displayName. */ - public displayName: string; - - /** Product description. */ - public description: string; - - /** Product productCategory. */ - public productCategory: string; - - /** Product productLabels. */ - public productLabels: google.cloud.vision.v1.Product.IKeyValue[]; - - /** - * Creates a new Product instance using the specified properties. - * @param [properties] Properties to set - * @returns Product instance - */ - public static create(properties?: google.cloud.vision.v1.IProduct): google.cloud.vision.v1.Product; - - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.vision.v1.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Product message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Product - * @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.Product; - - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Product - * @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.Product; - - /** - * Verifies a Product 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 Product message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Product - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Product; - - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Product to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Product - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Product { - - /** Properties of a KeyValue. */ - interface IKeyValue { - - /** KeyValue key */ - key?: (string|null); - - /** KeyValue value */ - value?: (string|null); - } - - /** Represents a KeyValue. */ - class KeyValue implements IKeyValue { - - /** - * Constructs a new KeyValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.Product.IKeyValue); - - /** KeyValue key. */ - public key: string; - - /** KeyValue value. */ - public value: string; - - /** - * Creates a new KeyValue instance using the specified properties. - * @param [properties] Properties to set - * @returns KeyValue instance - */ - public static create(properties?: google.cloud.vision.v1.Product.IKeyValue): google.cloud.vision.v1.Product.KeyValue; - - /** - * Encodes the specified KeyValue message. Does not implicitly {@link google.cloud.vision.v1.Product.KeyValue.verify|verify} messages. - * @param message KeyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.Product.IKeyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Product.KeyValue.verify|verify} messages. - * @param message KeyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.Product.IKeyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a KeyValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns KeyValue - * @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.Product.KeyValue; - - /** - * Decodes a KeyValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns KeyValue - * @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.Product.KeyValue; - - /** - * Verifies a KeyValue 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 KeyValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns KeyValue - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Product.KeyValue; - - /** - * Creates a plain object from a KeyValue message. Also converts values to other types if specified. - * @param message KeyValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Product.KeyValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this KeyValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for KeyValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a ProductSet. */ - interface IProductSet { - - /** ProductSet name */ - name?: (string|null); - - /** ProductSet displayName */ - displayName?: (string|null); - - /** ProductSet indexTime */ - indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSet indexError */ - indexError?: (google.rpc.IStatus|null); - } - - /** Represents a ProductSet. */ - class ProductSet implements IProductSet { - - /** - * Constructs a new ProductSet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IProductSet); - - /** ProductSet name. */ - public name: string; - - /** ProductSet displayName. */ - public displayName: string; - - /** ProductSet indexTime. */ - public indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSet indexError. */ - public indexError?: (google.rpc.IStatus|null); - - /** - * Creates a new ProductSet instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSet instance - */ - public static create(properties?: google.cloud.vision.v1.IProductSet): google.cloud.vision.v1.ProductSet; - - /** - * Encodes the specified ProductSet message. Does not implicitly {@link google.cloud.vision.v1.ProductSet.verify|verify} messages. - * @param message ProductSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IProductSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSet message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSet.verify|verify} messages. - * @param message ProductSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IProductSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSet - * @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.ProductSet; - - /** - * Decodes a ProductSet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSet - * @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.ProductSet; - - /** - * Verifies a ProductSet 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 ProductSet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ProductSet; - - /** - * Creates a plain object from a ProductSet message. Also converts values to other types if specified. - * @param message ProductSet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ProductSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSet - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReferenceImage. */ - interface IReferenceImage { - - /** ReferenceImage name */ - name?: (string|null); - - /** ReferenceImage uri */ - uri?: (string|null); - - /** ReferenceImage boundingPolys */ - boundingPolys?: (google.cloud.vision.v1.IBoundingPoly[]|null); - } - - /** Represents a ReferenceImage. */ - class ReferenceImage implements IReferenceImage { - - /** - * Constructs a new ReferenceImage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IReferenceImage); - - /** ReferenceImage name. */ - public name: string; - - /** ReferenceImage uri. */ - public uri: string; - - /** ReferenceImage boundingPolys. */ - public boundingPolys: google.cloud.vision.v1.IBoundingPoly[]; - - /** - * Creates a new ReferenceImage instance using the specified properties. - * @param [properties] Properties to set - * @returns ReferenceImage instance - */ - public static create(properties?: google.cloud.vision.v1.IReferenceImage): google.cloud.vision.v1.ReferenceImage; - - /** - * Encodes the specified ReferenceImage message. Does not implicitly {@link google.cloud.vision.v1.ReferenceImage.verify|verify} messages. - * @param message ReferenceImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IReferenceImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReferenceImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ReferenceImage.verify|verify} messages. - * @param message ReferenceImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IReferenceImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReferenceImage - * @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.ReferenceImage; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReferenceImage - * @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.ReferenceImage; - - /** - * Verifies a ReferenceImage 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 ReferenceImage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReferenceImage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ReferenceImage; - - /** - * Creates a plain object from a ReferenceImage message. Also converts values to other types if specified. - * @param message ReferenceImage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ReferenceImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReferenceImage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReferenceImage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { - - /** CreateProductRequest parent */ - parent?: (string|null); - - /** CreateProductRequest product */ - product?: (google.cloud.vision.v1.IProduct|null); - - /** CreateProductRequest productId */ - productId?: (string|null); - } - - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { - - /** - * Constructs a new CreateProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ICreateProductRequest); - - /** CreateProductRequest parent. */ - public parent: string; - - /** CreateProductRequest product. */ - public product?: (google.cloud.vision.v1.IProduct|null); - - /** CreateProductRequest productId. */ - public productId: string; - - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1.ICreateProductRequest): google.cloud.vision.v1.CreateProductRequest; - - /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.vision.v1.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateProductRequest - * @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.CreateProductRequest; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateProductRequest - * @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.CreateProductRequest; - - /** - * Verifies a CreateProductRequest 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 CreateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.CreateProductRequest; - - /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsRequest. */ - interface IListProductsRequest { - - /** ListProductsRequest parent */ - parent?: (string|null); - - /** ListProductsRequest pageSize */ - pageSize?: (number|null); - - /** ListProductsRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductsRequest. */ - class ListProductsRequest implements IListProductsRequest { - - /** - * Constructs a new ListProductsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IListProductsRequest); - - /** ListProductsRequest parent. */ - public parent: string; - - /** ListProductsRequest pageSize. */ - public pageSize: number; - - /** ListProductsRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IListProductsRequest): google.cloud.vision.v1.ListProductsRequest; - - /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.vision.v1.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsRequest - * @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.ListProductsRequest; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsRequest - * @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.ListProductsRequest; - - /** - * Verifies a ListProductsRequest 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 ListProductsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ListProductsRequest; - - /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. - * @param message ListProductsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsResponse. */ - interface IListProductsResponse { - - /** ListProductsResponse products */ - products?: (google.cloud.vision.v1.IProduct[]|null); - - /** ListProductsResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductsResponse. */ - class ListProductsResponse implements IListProductsResponse { - - /** - * Constructs a new ListProductsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IListProductsResponse); - - /** ListProductsResponse products. */ - public products: google.cloud.vision.v1.IProduct[]; - - /** ListProductsResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IListProductsResponse): google.cloud.vision.v1.ListProductsResponse; - - /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.vision.v1.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsResponse - * @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.ListProductsResponse; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsResponse - * @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.ListProductsResponse; - - /** - * Verifies a ListProductsResponse 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 ListProductsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ListProductsResponse; - - /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. - * @param message ListProductsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { - - /** GetProductRequest name */ - name?: (string|null); - } - - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { - - /** - * Constructs a new GetProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IGetProductRequest); - - /** GetProductRequest name. */ - public name: string; - - /** - * Creates a new GetProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IGetProductRequest): google.cloud.vision.v1.GetProductRequest; - - /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.vision.v1.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetProductRequest - * @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.GetProductRequest; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetProductRequest - * @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.GetProductRequest; - - /** - * Verifies a GetProductRequest 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 GetProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.GetProductRequest; - - /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { - - /** UpdateProductRequest product */ - product?: (google.cloud.vision.v1.IProduct|null); - - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { - - /** - * Constructs a new UpdateProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IUpdateProductRequest); - - /** UpdateProductRequest product. */ - public product?: (google.cloud.vision.v1.IProduct|null); - - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IUpdateProductRequest): google.cloud.vision.v1.UpdateProductRequest; - - /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.vision.v1.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateProductRequest - * @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.UpdateProductRequest; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest - * @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.UpdateProductRequest; - - /** - * Verifies an UpdateProductRequest 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 UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.UpdateProductRequest; - - /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UpdateProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UpdateProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { - - /** DeleteProductRequest name */ - name?: (string|null); - } - - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { - - /** - * Constructs a new DeleteProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IDeleteProductRequest); - - /** DeleteProductRequest name. */ - public name: string; - - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IDeleteProductRequest): google.cloud.vision.v1.DeleteProductRequest; - - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.vision.v1.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteProductRequest - * @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.DeleteProductRequest; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest - * @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.DeleteProductRequest; - - /** - * Verifies a DeleteProductRequest 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 DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.DeleteProductRequest; - - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateProductSetRequest. */ - interface ICreateProductSetRequest { - - /** CreateProductSetRequest parent */ - parent?: (string|null); - - /** CreateProductSetRequest productSet */ - productSet?: (google.cloud.vision.v1.IProductSet|null); - - /** CreateProductSetRequest productSetId */ - productSetId?: (string|null); - } - - /** Represents a CreateProductSetRequest. */ - class CreateProductSetRequest implements ICreateProductSetRequest { - - /** - * Constructs a new CreateProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ICreateProductSetRequest); - - /** CreateProductSetRequest parent. */ - public parent: string; - - /** CreateProductSetRequest productSet. */ - public productSet?: (google.cloud.vision.v1.IProductSet|null); - - /** CreateProductSetRequest productSetId. */ - public productSetId: string; - - /** - * Creates a new CreateProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1.ICreateProductSetRequest): google.cloud.vision.v1.CreateProductSetRequest; - - /** - * Encodes the specified CreateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.CreateProductSetRequest.verify|verify} messages. - * @param message CreateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ICreateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CreateProductSetRequest.verify|verify} messages. - * @param message CreateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ICreateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateProductSetRequest - * @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.CreateProductSetRequest; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateProductSetRequest - * @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.CreateProductSetRequest; - - /** - * Verifies a CreateProductSetRequest 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 CreateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.CreateProductSetRequest; - - /** - * Creates a plain object from a CreateProductSetRequest message. Also converts values to other types if specified. - * @param message CreateProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.CreateProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductSetsRequest. */ - interface IListProductSetsRequest { - - /** ListProductSetsRequest parent */ - parent?: (string|null); - - /** ListProductSetsRequest pageSize */ - pageSize?: (number|null); - - /** ListProductSetsRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductSetsRequest. */ - class ListProductSetsRequest implements IListProductSetsRequest { - - /** - * Constructs a new ListProductSetsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IListProductSetsRequest); - - /** ListProductSetsRequest parent. */ - public parent: string; - - /** ListProductSetsRequest pageSize. */ - public pageSize: number; - - /** ListProductSetsRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductSetsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductSetsRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IListProductSetsRequest): google.cloud.vision.v1.ListProductSetsRequest; - - /** - * Encodes the specified ListProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1.ListProductSetsRequest.verify|verify} messages. - * @param message ListProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IListProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductSetsRequest.verify|verify} messages. - * @param message ListProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IListProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductSetsRequest - * @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.ListProductSetsRequest; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductSetsRequest - * @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.ListProductSetsRequest; - - /** - * Verifies a ListProductSetsRequest 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 ListProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductSetsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ListProductSetsRequest; - - /** - * Creates a plain object from a ListProductSetsRequest message. Also converts values to other types if specified. - * @param message ListProductSetsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ListProductSetsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductSetsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductSetsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductSetsResponse. */ - interface IListProductSetsResponse { - - /** ListProductSetsResponse productSets */ - productSets?: (google.cloud.vision.v1.IProductSet[]|null); - - /** ListProductSetsResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductSetsResponse. */ - class ListProductSetsResponse implements IListProductSetsResponse { - - /** - * Constructs a new ListProductSetsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IListProductSetsResponse); - - /** ListProductSetsResponse productSets. */ - public productSets: google.cloud.vision.v1.IProductSet[]; - - /** ListProductSetsResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductSetsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductSetsResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IListProductSetsResponse): google.cloud.vision.v1.ListProductSetsResponse; - - /** - * Encodes the specified ListProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1.ListProductSetsResponse.verify|verify} messages. - * @param message ListProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IListProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductSetsResponse.verify|verify} messages. - * @param message ListProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IListProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductSetsResponse - * @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.ListProductSetsResponse; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductSetsResponse - * @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.ListProductSetsResponse; - - /** - * Verifies a ListProductSetsResponse 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 ListProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductSetsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ListProductSetsResponse; - - /** - * Creates a plain object from a ListProductSetsResponse message. Also converts values to other types if specified. - * @param message ListProductSetsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ListProductSetsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductSetsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductSetsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetProductSetRequest. */ - interface IGetProductSetRequest { - - /** GetProductSetRequest name */ - name?: (string|null); - } - - /** Represents a GetProductSetRequest. */ - class GetProductSetRequest implements IGetProductSetRequest { - - /** - * Constructs a new GetProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IGetProductSetRequest); - - /** GetProductSetRequest name. */ - public name: string; - - /** - * Creates a new GetProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IGetProductSetRequest): google.cloud.vision.v1.GetProductSetRequest; - - /** - * Encodes the specified GetProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.GetProductSetRequest.verify|verify} messages. - * @param message GetProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IGetProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GetProductSetRequest.verify|verify} messages. - * @param message GetProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IGetProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetProductSetRequest - * @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.GetProductSetRequest; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetProductSetRequest - * @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.GetProductSetRequest; - - /** - * Verifies a GetProductSetRequest 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 GetProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.GetProductSetRequest; - - /** - * Creates a plain object from a GetProductSetRequest message. Also converts values to other types if specified. - * @param message GetProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.GetProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an UpdateProductSetRequest. */ - interface IUpdateProductSetRequest { - - /** UpdateProductSetRequest productSet */ - productSet?: (google.cloud.vision.v1.IProductSet|null); - - /** UpdateProductSetRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateProductSetRequest. */ - class UpdateProductSetRequest implements IUpdateProductSetRequest { - - /** - * Constructs a new UpdateProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IUpdateProductSetRequest); - - /** UpdateProductSetRequest productSet. */ - public productSet?: (google.cloud.vision.v1.IProductSet|null); - - /** UpdateProductSetRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** - * Creates a new UpdateProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IUpdateProductSetRequest): google.cloud.vision.v1.UpdateProductSetRequest; - - /** - * Encodes the specified UpdateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.UpdateProductSetRequest.verify|verify} messages. - * @param message UpdateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IUpdateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.UpdateProductSetRequest.verify|verify} messages. - * @param message UpdateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IUpdateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateProductSetRequest - * @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.UpdateProductSetRequest; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateProductSetRequest - * @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.UpdateProductSetRequest; - - /** - * Verifies an UpdateProductSetRequest 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 UpdateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.UpdateProductSetRequest; - - /** - * Creates a plain object from an UpdateProductSetRequest message. Also converts values to other types if specified. - * @param message UpdateProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.UpdateProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UpdateProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UpdateProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteProductSetRequest. */ - interface IDeleteProductSetRequest { - - /** DeleteProductSetRequest name */ - name?: (string|null); - } - - /** Represents a DeleteProductSetRequest. */ - class DeleteProductSetRequest implements IDeleteProductSetRequest { - - /** - * Constructs a new DeleteProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IDeleteProductSetRequest); - - /** DeleteProductSetRequest name. */ - public name: string; - - /** - * Creates a new DeleteProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IDeleteProductSetRequest): google.cloud.vision.v1.DeleteProductSetRequest; - - /** - * Encodes the specified DeleteProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.DeleteProductSetRequest.verify|verify} messages. - * @param message DeleteProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IDeleteProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.DeleteProductSetRequest.verify|verify} messages. - * @param message DeleteProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IDeleteProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteProductSetRequest - * @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.DeleteProductSetRequest; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteProductSetRequest - * @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.DeleteProductSetRequest; - - /** - * Verifies a DeleteProductSetRequest 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 DeleteProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.DeleteProductSetRequest; - - /** - * Creates a plain object from a DeleteProductSetRequest message. Also converts values to other types if specified. - * @param message DeleteProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.DeleteProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateReferenceImageRequest. */ - interface ICreateReferenceImageRequest { - - /** CreateReferenceImageRequest parent */ - parent?: (string|null); - - /** CreateReferenceImageRequest referenceImage */ - referenceImage?: (google.cloud.vision.v1.IReferenceImage|null); - - /** CreateReferenceImageRequest referenceImageId */ - referenceImageId?: (string|null); - } - - /** Represents a CreateReferenceImageRequest. */ - class CreateReferenceImageRequest implements ICreateReferenceImageRequest { - - /** - * Constructs a new CreateReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ICreateReferenceImageRequest); - - /** CreateReferenceImageRequest parent. */ - public parent: string; - - /** CreateReferenceImageRequest referenceImage. */ - public referenceImage?: (google.cloud.vision.v1.IReferenceImage|null); - - /** CreateReferenceImageRequest referenceImageId. */ - public referenceImageId: string; - - /** - * Creates a new CreateReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1.ICreateReferenceImageRequest): google.cloud.vision.v1.CreateReferenceImageRequest; - - /** - * Encodes the specified CreateReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1.CreateReferenceImageRequest.verify|verify} messages. - * @param message CreateReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ICreateReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CreateReferenceImageRequest.verify|verify} messages. - * @param message CreateReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ICreateReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateReferenceImageRequest - * @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.CreateReferenceImageRequest; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateReferenceImageRequest - * @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.CreateReferenceImageRequest; - - /** - * Verifies a CreateReferenceImageRequest 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 CreateReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.CreateReferenceImageRequest; - - /** - * Creates a plain object from a CreateReferenceImageRequest message. Also converts values to other types if specified. - * @param message CreateReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.CreateReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListReferenceImagesRequest. */ - interface IListReferenceImagesRequest { - - /** ListReferenceImagesRequest parent */ - parent?: (string|null); - - /** ListReferenceImagesRequest pageSize */ - pageSize?: (number|null); - - /** ListReferenceImagesRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListReferenceImagesRequest. */ - class ListReferenceImagesRequest implements IListReferenceImagesRequest { - - /** - * Constructs a new ListReferenceImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IListReferenceImagesRequest); - - /** ListReferenceImagesRequest parent. */ - public parent: string; - - /** ListReferenceImagesRequest pageSize. */ - public pageSize: number; - - /** ListReferenceImagesRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListReferenceImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListReferenceImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IListReferenceImagesRequest): google.cloud.vision.v1.ListReferenceImagesRequest; - - /** - * Encodes the specified ListReferenceImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.ListReferenceImagesRequest.verify|verify} messages. - * @param message ListReferenceImagesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IListReferenceImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListReferenceImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListReferenceImagesRequest.verify|verify} messages. - * @param message ListReferenceImagesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IListReferenceImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListReferenceImagesRequest - * @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.ListReferenceImagesRequest; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListReferenceImagesRequest - * @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.ListReferenceImagesRequest; - - /** - * Verifies a ListReferenceImagesRequest 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 ListReferenceImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListReferenceImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ListReferenceImagesRequest; - - /** - * Creates a plain object from a ListReferenceImagesRequest message. Also converts values to other types if specified. - * @param message ListReferenceImagesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ListReferenceImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListReferenceImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListReferenceImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListReferenceImagesResponse. */ - interface IListReferenceImagesResponse { - - /** ListReferenceImagesResponse referenceImages */ - referenceImages?: (google.cloud.vision.v1.IReferenceImage[]|null); - - /** ListReferenceImagesResponse pageSize */ - pageSize?: (number|null); - - /** ListReferenceImagesResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListReferenceImagesResponse. */ - class ListReferenceImagesResponse implements IListReferenceImagesResponse { - - /** - * Constructs a new ListReferenceImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IListReferenceImagesResponse); - - /** ListReferenceImagesResponse referenceImages. */ - public referenceImages: google.cloud.vision.v1.IReferenceImage[]; - - /** ListReferenceImagesResponse pageSize. */ - public pageSize: number; - - /** ListReferenceImagesResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListReferenceImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListReferenceImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IListReferenceImagesResponse): google.cloud.vision.v1.ListReferenceImagesResponse; - - /** - * Encodes the specified ListReferenceImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.ListReferenceImagesResponse.verify|verify} messages. - * @param message ListReferenceImagesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IListReferenceImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListReferenceImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListReferenceImagesResponse.verify|verify} messages. - * @param message ListReferenceImagesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IListReferenceImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListReferenceImagesResponse - * @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.ListReferenceImagesResponse; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListReferenceImagesResponse - * @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.ListReferenceImagesResponse; - - /** - * Verifies a ListReferenceImagesResponse 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 ListReferenceImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListReferenceImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ListReferenceImagesResponse; - - /** - * Creates a plain object from a ListReferenceImagesResponse message. Also converts values to other types if specified. - * @param message ListReferenceImagesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ListReferenceImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListReferenceImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListReferenceImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetReferenceImageRequest. */ - interface IGetReferenceImageRequest { - - /** GetReferenceImageRequest name */ - name?: (string|null); - } - - /** Represents a GetReferenceImageRequest. */ - class GetReferenceImageRequest implements IGetReferenceImageRequest { - - /** - * Constructs a new GetReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IGetReferenceImageRequest); - - /** GetReferenceImageRequest name. */ - public name: string; - - /** - * Creates a new GetReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IGetReferenceImageRequest): google.cloud.vision.v1.GetReferenceImageRequest; - - /** - * Encodes the specified GetReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1.GetReferenceImageRequest.verify|verify} messages. - * @param message GetReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IGetReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GetReferenceImageRequest.verify|verify} messages. - * @param message GetReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IGetReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetReferenceImageRequest - * @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.GetReferenceImageRequest; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetReferenceImageRequest - * @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.GetReferenceImageRequest; - - /** - * Verifies a GetReferenceImageRequest 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 GetReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.GetReferenceImageRequest; - - /** - * Creates a plain object from a GetReferenceImageRequest message. Also converts values to other types if specified. - * @param message GetReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.GetReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteReferenceImageRequest. */ - interface IDeleteReferenceImageRequest { - - /** DeleteReferenceImageRequest name */ - name?: (string|null); - } - - /** Represents a DeleteReferenceImageRequest. */ - class DeleteReferenceImageRequest implements IDeleteReferenceImageRequest { - - /** - * Constructs a new DeleteReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IDeleteReferenceImageRequest); - - /** DeleteReferenceImageRequest name. */ - public name: string; - - /** - * Creates a new DeleteReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IDeleteReferenceImageRequest): google.cloud.vision.v1.DeleteReferenceImageRequest; - - /** - * Encodes the specified DeleteReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1.DeleteReferenceImageRequest.verify|verify} messages. - * @param message DeleteReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IDeleteReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.DeleteReferenceImageRequest.verify|verify} messages. - * @param message DeleteReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IDeleteReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest; - - /** - * Verifies a DeleteReferenceImageRequest 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 DeleteReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.DeleteReferenceImageRequest; - - /** - * Creates a plain object from a DeleteReferenceImageRequest message. Also converts values to other types if specified. - * @param message DeleteReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.DeleteReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AddProductToProductSetRequest. */ - interface IAddProductToProductSetRequest { - - /** AddProductToProductSetRequest name */ - name?: (string|null); - - /** AddProductToProductSetRequest product */ - product?: (string|null); - } - - /** Represents an AddProductToProductSetRequest. */ - class AddProductToProductSetRequest implements IAddProductToProductSetRequest { - - /** - * Constructs a new AddProductToProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IAddProductToProductSetRequest); - - /** AddProductToProductSetRequest name. */ - public name: string; - - /** AddProductToProductSetRequest product. */ - public product: string; - - /** - * Creates a new AddProductToProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AddProductToProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IAddProductToProductSetRequest): google.cloud.vision.v1.AddProductToProductSetRequest; - - /** - * Encodes the specified AddProductToProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.AddProductToProductSetRequest.verify|verify} messages. - * @param message AddProductToProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IAddProductToProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AddProductToProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AddProductToProductSetRequest.verify|verify} messages. - * @param message AddProductToProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IAddProductToProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AddProductToProductSetRequest - * @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.AddProductToProductSetRequest; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AddProductToProductSetRequest - * @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.AddProductToProductSetRequest; - - /** - * Verifies an AddProductToProductSetRequest 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 AddProductToProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AddProductToProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.AddProductToProductSetRequest; - - /** - * Creates a plain object from an AddProductToProductSetRequest message. Also converts values to other types if specified. - * @param message AddProductToProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.AddProductToProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AddProductToProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AddProductToProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RemoveProductFromProductSetRequest. */ - interface IRemoveProductFromProductSetRequest { - - /** RemoveProductFromProductSetRequest name */ - name?: (string|null); - - /** RemoveProductFromProductSetRequest product */ - product?: (string|null); - } - - /** Represents a RemoveProductFromProductSetRequest. */ - class RemoveProductFromProductSetRequest implements IRemoveProductFromProductSetRequest { - - /** - * Constructs a new RemoveProductFromProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IRemoveProductFromProductSetRequest); - - /** RemoveProductFromProductSetRequest name. */ - public name: string; - - /** RemoveProductFromProductSetRequest product. */ - public product: string; - - /** - * Creates a new RemoveProductFromProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns RemoveProductFromProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IRemoveProductFromProductSetRequest): google.cloud.vision.v1.RemoveProductFromProductSetRequest; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @param message RemoveProductFromProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IRemoveProductFromProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @param message RemoveProductFromProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IRemoveProductFromProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest; - - /** - * Verifies a RemoveProductFromProductSetRequest 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 RemoveProductFromProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RemoveProductFromProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.RemoveProductFromProductSetRequest; - - /** - * Creates a plain object from a RemoveProductFromProductSetRequest message. Also converts values to other types if specified. - * @param message RemoveProductFromProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.RemoveProductFromProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RemoveProductFromProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RemoveProductFromProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsInProductSetRequest. */ - interface IListProductsInProductSetRequest { - - /** ListProductsInProductSetRequest name */ - name?: (string|null); - - /** ListProductsInProductSetRequest pageSize */ - pageSize?: (number|null); - - /** ListProductsInProductSetRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductsInProductSetRequest. */ - class ListProductsInProductSetRequest implements IListProductsInProductSetRequest { - - /** - * Constructs a new ListProductsInProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IListProductsInProductSetRequest); - - /** ListProductsInProductSetRequest name. */ - public name: string; - - /** ListProductsInProductSetRequest pageSize. */ - public pageSize: number; - - /** ListProductsInProductSetRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductsInProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsInProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IListProductsInProductSetRequest): google.cloud.vision.v1.ListProductsInProductSetRequest; - - /** - * Encodes the specified ListProductsInProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.ListProductsInProductSetRequest.verify|verify} messages. - * @param message ListProductsInProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IListProductsInProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsInProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductsInProductSetRequest.verify|verify} messages. - * @param message ListProductsInProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IListProductsInProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest; - - /** - * Verifies a ListProductsInProductSetRequest 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 ListProductsInProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsInProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ListProductsInProductSetRequest; - - /** - * Creates a plain object from a ListProductsInProductSetRequest message. Also converts values to other types if specified. - * @param message ListProductsInProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ListProductsInProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsInProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsInProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsInProductSetResponse. */ - interface IListProductsInProductSetResponse { - - /** ListProductsInProductSetResponse products */ - products?: (google.cloud.vision.v1.IProduct[]|null); - - /** ListProductsInProductSetResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductsInProductSetResponse. */ - class ListProductsInProductSetResponse implements IListProductsInProductSetResponse { - - /** - * Constructs a new ListProductsInProductSetResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IListProductsInProductSetResponse); - - /** ListProductsInProductSetResponse products. */ - public products: google.cloud.vision.v1.IProduct[]; - - /** ListProductsInProductSetResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductsInProductSetResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsInProductSetResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IListProductsInProductSetResponse): google.cloud.vision.v1.ListProductsInProductSetResponse; - - /** - * Encodes the specified ListProductsInProductSetResponse message. Does not implicitly {@link google.cloud.vision.v1.ListProductsInProductSetResponse.verify|verify} messages. - * @param message ListProductsInProductSetResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IListProductsInProductSetResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsInProductSetResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductsInProductSetResponse.verify|verify} messages. - * @param message ListProductsInProductSetResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IListProductsInProductSetResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse; - - /** - * Verifies a ListProductsInProductSetResponse 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 ListProductsInProductSetResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsInProductSetResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ListProductsInProductSetResponse; - - /** - * Creates a plain object from a ListProductsInProductSetResponse message. Also converts values to other types if specified. - * @param message ListProductsInProductSetResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ListProductsInProductSetResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsInProductSetResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsInProductSetResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsGcsSource. */ - interface IImportProductSetsGcsSource { - - /** ImportProductSetsGcsSource csvFileUri */ - csvFileUri?: (string|null); - } - - /** Represents an ImportProductSetsGcsSource. */ - class ImportProductSetsGcsSource implements IImportProductSetsGcsSource { - - /** - * Constructs a new ImportProductSetsGcsSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImportProductSetsGcsSource); - - /** ImportProductSetsGcsSource csvFileUri. */ - public csvFileUri: string; - - /** - * Creates a new ImportProductSetsGcsSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsGcsSource instance - */ - public static create(properties?: google.cloud.vision.v1.IImportProductSetsGcsSource): google.cloud.vision.v1.ImportProductSetsGcsSource; - - /** - * Encodes the specified ImportProductSetsGcsSource message. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsGcsSource.verify|verify} messages. - * @param message ImportProductSetsGcsSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IImportProductSetsGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsGcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsGcsSource.verify|verify} messages. - * @param message ImportProductSetsGcsSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IImportProductSetsGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource; - - /** - * Verifies an ImportProductSetsGcsSource 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 ImportProductSetsGcsSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsGcsSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ImportProductSetsGcsSource; - - /** - * Creates a plain object from an ImportProductSetsGcsSource message. Also converts values to other types if specified. - * @param message ImportProductSetsGcsSource - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ImportProductSetsGcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsGcsSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsGcsSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsInputConfig. */ - interface IImportProductSetsInputConfig { - - /** ImportProductSetsInputConfig gcsSource */ - gcsSource?: (google.cloud.vision.v1.IImportProductSetsGcsSource|null); - } - - /** Represents an ImportProductSetsInputConfig. */ - class ImportProductSetsInputConfig implements IImportProductSetsInputConfig { - - /** - * Constructs a new ImportProductSetsInputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImportProductSetsInputConfig); - - /** ImportProductSetsInputConfig gcsSource. */ - public gcsSource?: (google.cloud.vision.v1.IImportProductSetsGcsSource|null); - - /** ImportProductSetsInputConfig source. */ - public source?: "gcsSource"; - - /** - * Creates a new ImportProductSetsInputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsInputConfig instance - */ - public static create(properties?: google.cloud.vision.v1.IImportProductSetsInputConfig): google.cloud.vision.v1.ImportProductSetsInputConfig; - - /** - * Encodes the specified ImportProductSetsInputConfig message. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsInputConfig.verify|verify} messages. - * @param message ImportProductSetsInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IImportProductSetsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsInputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsInputConfig.verify|verify} messages. - * @param message ImportProductSetsInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IImportProductSetsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig; - - /** - * Verifies an ImportProductSetsInputConfig 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 ImportProductSetsInputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsInputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ImportProductSetsInputConfig; - - /** - * Creates a plain object from an ImportProductSetsInputConfig message. Also converts values to other types if specified. - * @param message ImportProductSetsInputConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ImportProductSetsInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsInputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsInputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsRequest. */ - interface IImportProductSetsRequest { - - /** ImportProductSetsRequest parent */ - parent?: (string|null); - - /** ImportProductSetsRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1.IImportProductSetsInputConfig|null); - } - - /** Represents an ImportProductSetsRequest. */ - class ImportProductSetsRequest implements IImportProductSetsRequest { - - /** - * Constructs a new ImportProductSetsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImportProductSetsRequest); - - /** ImportProductSetsRequest parent. */ - public parent: string; - - /** ImportProductSetsRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1.IImportProductSetsInputConfig|null); - - /** - * Creates a new ImportProductSetsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IImportProductSetsRequest): google.cloud.vision.v1.ImportProductSetsRequest; - - /** - * Encodes the specified ImportProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsRequest.verify|verify} messages. - * @param message ImportProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IImportProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsRequest.verify|verify} messages. - * @param message ImportProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IImportProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsRequest - * @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.ImportProductSetsRequest; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsRequest - * @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.ImportProductSetsRequest; - - /** - * Verifies an ImportProductSetsRequest 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 ImportProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ImportProductSetsRequest; - - /** - * Creates a plain object from an ImportProductSetsRequest message. Also converts values to other types if specified. - * @param message ImportProductSetsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ImportProductSetsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsResponse. */ - interface IImportProductSetsResponse { - - /** ImportProductSetsResponse referenceImages */ - referenceImages?: (google.cloud.vision.v1.IReferenceImage[]|null); - - /** ImportProductSetsResponse statuses */ - statuses?: (google.rpc.IStatus[]|null); - } - - /** Represents an ImportProductSetsResponse. */ - class ImportProductSetsResponse implements IImportProductSetsResponse { - - /** - * Constructs a new ImportProductSetsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IImportProductSetsResponse); - - /** ImportProductSetsResponse referenceImages. */ - public referenceImages: google.cloud.vision.v1.IReferenceImage[]; - - /** ImportProductSetsResponse statuses. */ - public statuses: google.rpc.IStatus[]; - - /** - * Creates a new ImportProductSetsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsResponse instance - */ - public static create(properties?: google.cloud.vision.v1.IImportProductSetsResponse): google.cloud.vision.v1.ImportProductSetsResponse; - - /** - * Encodes the specified ImportProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsResponse.verify|verify} messages. - * @param message ImportProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IImportProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsResponse.verify|verify} messages. - * @param message ImportProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IImportProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsResponse - * @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.ImportProductSetsResponse; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsResponse - * @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.ImportProductSetsResponse; - - /** - * Verifies an ImportProductSetsResponse 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 ImportProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ImportProductSetsResponse; - - /** - * Creates a plain object from an ImportProductSetsResponse message. Also converts values to other types if specified. - * @param message ImportProductSetsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ImportProductSetsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchOperationMetadata. */ - interface IBatchOperationMetadata { - - /** BatchOperationMetadata state */ - state?: (google.cloud.vision.v1.BatchOperationMetadata.State|keyof typeof google.cloud.vision.v1.BatchOperationMetadata.State|null); - - /** BatchOperationMetadata submitTime */ - submitTime?: (google.protobuf.ITimestamp|null); - - /** BatchOperationMetadata endTime */ - endTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a BatchOperationMetadata. */ - class BatchOperationMetadata implements IBatchOperationMetadata { - - /** - * Constructs a new BatchOperationMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IBatchOperationMetadata); - - /** BatchOperationMetadata state. */ - public state: (google.cloud.vision.v1.BatchOperationMetadata.State|keyof typeof google.cloud.vision.v1.BatchOperationMetadata.State); - - /** BatchOperationMetadata submitTime. */ - public submitTime?: (google.protobuf.ITimestamp|null); - - /** BatchOperationMetadata endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new BatchOperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchOperationMetadata instance - */ - public static create(properties?: google.cloud.vision.v1.IBatchOperationMetadata): google.cloud.vision.v1.BatchOperationMetadata; - - /** - * Encodes the specified BatchOperationMetadata message. Does not implicitly {@link google.cloud.vision.v1.BatchOperationMetadata.verify|verify} messages. - * @param message BatchOperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IBatchOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchOperationMetadata.verify|verify} messages. - * @param message BatchOperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IBatchOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BatchOperationMetadata - * @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.BatchOperationMetadata; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BatchOperationMetadata - * @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.BatchOperationMetadata; - - /** - * Verifies a BatchOperationMetadata 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 BatchOperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchOperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.BatchOperationMetadata; - - /** - * Creates a plain object from a BatchOperationMetadata message. Also converts values to other types if specified. - * @param message BatchOperationMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.BatchOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchOperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchOperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BatchOperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - PROCESSING = 1, - SUCCESSFUL = 2, - FAILED = 3, - CANCELLED = 4 - } - } - - /** Properties of a ProductSetPurgeConfig. */ - interface IProductSetPurgeConfig { - - /** ProductSetPurgeConfig productSetId */ - productSetId?: (string|null); - } - - /** Represents a ProductSetPurgeConfig. */ - class ProductSetPurgeConfig implements IProductSetPurgeConfig { - - /** - * Constructs a new ProductSetPurgeConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IProductSetPurgeConfig); - - /** ProductSetPurgeConfig productSetId. */ - public productSetId: string; - - /** - * Creates a new ProductSetPurgeConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSetPurgeConfig instance - */ - public static create(properties?: google.cloud.vision.v1.IProductSetPurgeConfig): google.cloud.vision.v1.ProductSetPurgeConfig; - - /** - * Encodes the specified ProductSetPurgeConfig message. Does not implicitly {@link google.cloud.vision.v1.ProductSetPurgeConfig.verify|verify} messages. - * @param message ProductSetPurgeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IProductSetPurgeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSetPurgeConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSetPurgeConfig.verify|verify} messages. - * @param message ProductSetPurgeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IProductSetPurgeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSetPurgeConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSetPurgeConfig - * @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.ProductSetPurgeConfig; - - /** - * Decodes a ProductSetPurgeConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSetPurgeConfig - * @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.ProductSetPurgeConfig; - - /** - * Verifies a ProductSetPurgeConfig 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 ProductSetPurgeConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSetPurgeConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.ProductSetPurgeConfig; - - /** - * Creates a plain object from a ProductSetPurgeConfig message. Also converts values to other types if specified. - * @param message ProductSetPurgeConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.ProductSetPurgeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSetPurgeConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSetPurgeConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PurgeProductsRequest. */ - interface IPurgeProductsRequest { - - /** PurgeProductsRequest productSetPurgeConfig */ - productSetPurgeConfig?: (google.cloud.vision.v1.IProductSetPurgeConfig|null); - - /** PurgeProductsRequest deleteOrphanProducts */ - deleteOrphanProducts?: (boolean|null); - - /** PurgeProductsRequest parent */ - parent?: (string|null); - - /** PurgeProductsRequest force */ - force?: (boolean|null); - } - - /** Represents a PurgeProductsRequest. */ - class PurgeProductsRequest implements IPurgeProductsRequest { - - /** - * Constructs a new PurgeProductsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IPurgeProductsRequest); - - /** PurgeProductsRequest productSetPurgeConfig. */ - public productSetPurgeConfig?: (google.cloud.vision.v1.IProductSetPurgeConfig|null); - - /** PurgeProductsRequest deleteOrphanProducts. */ - public deleteOrphanProducts?: (boolean|null); - - /** PurgeProductsRequest parent. */ - public parent: string; - - /** PurgeProductsRequest force. */ - public force: boolean; - - /** PurgeProductsRequest target. */ - public target?: ("productSetPurgeConfig"|"deleteOrphanProducts"); - - /** - * Creates a new PurgeProductsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeProductsRequest instance - */ - public static create(properties?: google.cloud.vision.v1.IPurgeProductsRequest): google.cloud.vision.v1.PurgeProductsRequest; - - /** - * Encodes the specified PurgeProductsRequest message. Does not implicitly {@link google.cloud.vision.v1.PurgeProductsRequest.verify|verify} messages. - * @param message PurgeProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IPurgeProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PurgeProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.PurgeProductsRequest.verify|verify} messages. - * @param message PurgeProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IPurgeProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PurgeProductsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeProductsRequest - * @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.PurgeProductsRequest; - - /** - * Decodes a PurgeProductsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeProductsRequest - * @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.PurgeProductsRequest; - - /** - * Verifies a PurgeProductsRequest 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 PurgeProductsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeProductsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.PurgeProductsRequest; - - /** - * Creates a plain object from a PurgeProductsRequest message. Also converts values to other types if specified. - * @param message PurgeProductsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.PurgeProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PurgeProductsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PurgeProductsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TextAnnotation. */ - interface ITextAnnotation { - - /** TextAnnotation pages */ - pages?: (google.cloud.vision.v1.IPage[]|null); - - /** TextAnnotation text */ - text?: (string|null); - } - - /** Represents a TextAnnotation. */ - class TextAnnotation implements ITextAnnotation { - - /** - * Constructs a new TextAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ITextAnnotation); - - /** TextAnnotation pages. */ - public pages: google.cloud.vision.v1.IPage[]; - - /** TextAnnotation text. */ - public text: string; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns TextAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1.ITextAnnotation): google.cloud.vision.v1.TextAnnotation; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Verifies a TextAnnotation 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 TextAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.TextAnnotation; - - /** - * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. - * @param message TextAnnotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.TextAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace TextAnnotation { - - /** Properties of a DetectedLanguage. */ - interface IDetectedLanguage { - - /** DetectedLanguage languageCode */ - languageCode?: (string|null); - - /** DetectedLanguage confidence */ - confidence?: (number|null); - } - - /** Represents a DetectedLanguage. */ - class DetectedLanguage implements IDetectedLanguage { - - /** - * Constructs a new DetectedLanguage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.TextAnnotation.IDetectedLanguage); - - /** DetectedLanguage languageCode. */ - public languageCode: string; - - /** DetectedLanguage confidence. */ - public confidence: number; - - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedLanguage instance - */ - public static create(properties?: google.cloud.vision.v1.TextAnnotation.IDetectedLanguage): google.cloud.vision.v1.TextAnnotation.DetectedLanguage; - - /** - * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Verifies a DetectedLanguage 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 DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedLanguage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.TextAnnotation.DetectedLanguage; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @param message DetectedLanguage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.TextAnnotation.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedLanguage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedLanguage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DetectedBreak. */ - interface IDetectedBreak { - - /** DetectedBreak type */ - type?: (google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType|null); - - /** DetectedBreak isPrefix */ - isPrefix?: (boolean|null); - } - - /** Represents a DetectedBreak. */ - class DetectedBreak implements IDetectedBreak { - - /** - * Constructs a new DetectedBreak. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.TextAnnotation.IDetectedBreak); - - /** DetectedBreak type. */ - public type: (google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType); - - /** DetectedBreak isPrefix. */ - public isPrefix: boolean; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedBreak instance - */ - public static create(properties?: google.cloud.vision.v1.TextAnnotation.IDetectedBreak): google.cloud.vision.v1.TextAnnotation.DetectedBreak; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Verifies a DetectedBreak 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 DetectedBreak message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedBreak - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.TextAnnotation.DetectedBreak; - - /** - * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. - * @param message DetectedBreak - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.TextAnnotation.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedBreak to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedBreak - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DetectedBreak { - - /** BreakType enum. */ - enum BreakType { - UNKNOWN = 0, - SPACE = 1, - SURE_SPACE = 2, - EOL_SURE_SPACE = 3, - HYPHEN = 4, - LINE_BREAK = 5 - } - } - - /** Properties of a TextProperty. */ - interface ITextProperty { - - /** TextProperty detectedLanguages */ - detectedLanguages?: (google.cloud.vision.v1.TextAnnotation.IDetectedLanguage[]|null); - - /** TextProperty detectedBreak */ - detectedBreak?: (google.cloud.vision.v1.TextAnnotation.IDetectedBreak|null); - } - - /** Represents a TextProperty. */ - class TextProperty implements ITextProperty { - - /** - * Constructs a new TextProperty. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.TextAnnotation.ITextProperty); - - /** TextProperty detectedLanguages. */ - public detectedLanguages: google.cloud.vision.v1.TextAnnotation.IDetectedLanguage[]; - - /** TextProperty detectedBreak. */ - public detectedBreak?: (google.cloud.vision.v1.TextAnnotation.IDetectedBreak|null); - - /** - * Creates a new TextProperty instance using the specified properties. - * @param [properties] Properties to set - * @returns TextProperty instance - */ - public static create(properties?: google.cloud.vision.v1.TextAnnotation.ITextProperty): google.cloud.vision.v1.TextAnnotation.TextProperty; - - /** - * Encodes the specified TextProperty message. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextProperty message, length delimited. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextProperty message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Decodes a TextProperty message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Verifies a TextProperty 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 TextProperty message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextProperty - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.TextAnnotation.TextProperty; - - /** - * Creates a plain object from a TextProperty message. Also converts values to other types if specified. - * @param message TextProperty - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.TextAnnotation.TextProperty, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextProperty to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextProperty - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a Page. */ - interface IPage { - - /** Page property */ - property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Page width */ - width?: (number|null); - - /** Page height */ - height?: (number|null); - - /** Page blocks */ - blocks?: (google.cloud.vision.v1.IBlock[]|null); - - /** Page confidence */ - confidence?: (number|null); - } - - /** Represents a Page. */ - class Page implements IPage { - - /** - * Constructs a new Page. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IPage); - - /** Page property. */ - public property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Page width. */ - public width: number; - - /** Page height. */ - public height: number; - - /** Page blocks. */ - public blocks: google.cloud.vision.v1.IBlock[]; - - /** Page confidence. */ - public confidence: number; - - /** - * Creates a new Page instance using the specified properties. - * @param [properties] Properties to set - * @returns Page instance - */ - public static create(properties?: google.cloud.vision.v1.IPage): google.cloud.vision.v1.Page; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Page message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Page - * @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.Page; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Page - * @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.Page; - - /** - * Verifies a Page 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 Page message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Page - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Page; - - /** - * Creates a plain object from a Page message. Also converts values to other types if specified. - * @param message Page - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Page to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Page - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Block. */ - interface IBlock { - - /** Block property */ - property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox */ - boundingBox?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** Block paragraphs */ - paragraphs?: (google.cloud.vision.v1.IParagraph[]|null); - - /** Block blockType */ - blockType?: (google.cloud.vision.v1.Block.BlockType|keyof typeof google.cloud.vision.v1.Block.BlockType|null); - - /** Block confidence */ - confidence?: (number|null); - } - - /** Represents a Block. */ - class Block implements IBlock { - - /** - * Constructs a new Block. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IBlock); - - /** Block property. */ - public property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox. */ - public boundingBox?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** Block paragraphs. */ - public paragraphs: google.cloud.vision.v1.IParagraph[]; - - /** Block blockType. */ - public blockType: (google.cloud.vision.v1.Block.BlockType|keyof typeof google.cloud.vision.v1.Block.BlockType); - - /** Block confidence. */ - public confidence: number; - - /** - * Creates a new Block instance using the specified properties. - * @param [properties] Properties to set - * @returns Block instance - */ - public static create(properties?: google.cloud.vision.v1.IBlock): google.cloud.vision.v1.Block; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Block message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Block - * @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.Block; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Block - * @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.Block; - - /** - * Verifies a Block 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 Block message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Block - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Block; - - /** - * Creates a plain object from a Block message. Also converts values to other types if specified. - * @param message Block - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Block to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Block - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Block { - - /** BlockType enum. */ - enum BlockType { - UNKNOWN = 0, - TEXT = 1, - TABLE = 2, - PICTURE = 3, - RULER = 4, - BARCODE = 5 - } - } - - /** Properties of a Paragraph. */ - interface IParagraph { - - /** Paragraph property */ - property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox */ - boundingBox?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** Paragraph words */ - words?: (google.cloud.vision.v1.IWord[]|null); - - /** Paragraph confidence */ - confidence?: (number|null); - } - - /** Represents a Paragraph. */ - class Paragraph implements IParagraph { - - /** - * Constructs a new Paragraph. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IParagraph); - - /** Paragraph property. */ - public property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox. */ - public boundingBox?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** Paragraph words. */ - public words: google.cloud.vision.v1.IWord[]; - - /** Paragraph confidence. */ - public confidence: number; - - /** - * Creates a new Paragraph instance using the specified properties. - * @param [properties] Properties to set - * @returns Paragraph instance - */ - public static create(properties?: google.cloud.vision.v1.IParagraph): google.cloud.vision.v1.Paragraph; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Paragraph message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Paragraph - * @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.Paragraph; - - /** - * Decodes a Paragraph message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Paragraph - * @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.Paragraph; - - /** - * Verifies a Paragraph 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 Paragraph message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Paragraph - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Paragraph; - - /** - * Creates a plain object from a Paragraph message. Also converts values to other types if specified. - * @param message Paragraph - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Paragraph to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Paragraph - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Word. */ - interface IWord { - - /** Word property */ - property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox */ - boundingBox?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** Word symbols */ - symbols?: (google.cloud.vision.v1.ISymbol[]|null); - - /** Word confidence */ - confidence?: (number|null); - } - - /** Represents a Word. */ - class Word implements IWord { - - /** - * Constructs a new Word. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IWord); - - /** Word property. */ - public property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox. */ - public boundingBox?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** Word symbols. */ - public symbols: google.cloud.vision.v1.ISymbol[]; - - /** Word confidence. */ - public confidence: number; - - /** - * Creates a new Word instance using the specified properties. - * @param [properties] Properties to set - * @returns Word instance - */ - public static create(properties?: google.cloud.vision.v1.IWord): google.cloud.vision.v1.Word; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Word message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Word message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Word - * @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.Word; - - /** - * Decodes a Word message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Word - * @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.Word; - - /** - * Verifies a Word 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 Word message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Word - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Word; - - /** - * Creates a plain object from a Word message. Also converts values to other types if specified. - * @param message Word - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Word, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Word to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Word - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Symbol. */ - interface ISymbol { - - /** Symbol property */ - property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox */ - boundingBox?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** Symbol text */ - text?: (string|null); - - /** Symbol confidence */ - confidence?: (number|null); - } - - /** Represents a Symbol. */ - class Symbol implements ISymbol { - - /** - * Constructs a new Symbol. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.ISymbol); - - /** Symbol property. */ - public property?: (google.cloud.vision.v1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox. */ - public boundingBox?: (google.cloud.vision.v1.IBoundingPoly|null); - - /** Symbol text. */ - public text: string; - - /** Symbol confidence. */ - public confidence: number; - - /** - * Creates a new Symbol instance using the specified properties. - * @param [properties] Properties to set - * @returns Symbol instance - */ - public static create(properties?: google.cloud.vision.v1.ISymbol): google.cloud.vision.v1.Symbol; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Symbol message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1.Symbol; - - /** - * Decodes a Symbol message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1.Symbol; - - /** - * Verifies a Symbol message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Symbol message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Symbol - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Symbol; - - /** - * Creates a plain object from a Symbol message. Also converts values to other types if specified. - * @param message Symbol - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Symbol to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Symbol - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetection. */ - interface IWebDetection { - - /** WebDetection webEntities */ - webEntities?: (google.cloud.vision.v1.WebDetection.IWebEntity[]|null); - - /** WebDetection fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1.WebDetection.IWebImage[]|null); - - /** WebDetection partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1.WebDetection.IWebImage[]|null); - - /** WebDetection pagesWithMatchingImages */ - pagesWithMatchingImages?: (google.cloud.vision.v1.WebDetection.IWebPage[]|null); - - /** WebDetection visuallySimilarImages */ - visuallySimilarImages?: (google.cloud.vision.v1.WebDetection.IWebImage[]|null); - - /** WebDetection bestGuessLabels */ - bestGuessLabels?: (google.cloud.vision.v1.WebDetection.IWebLabel[]|null); - } - - /** Represents a WebDetection. */ - class WebDetection implements IWebDetection { - - /** - * Constructs a new WebDetection. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IWebDetection); - - /** WebDetection webEntities. */ - public webEntities: google.cloud.vision.v1.WebDetection.IWebEntity[]; - - /** WebDetection fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1.WebDetection.IWebImage[]; - - /** WebDetection partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1.WebDetection.IWebImage[]; - - /** WebDetection pagesWithMatchingImages. */ - public pagesWithMatchingImages: google.cloud.vision.v1.WebDetection.IWebPage[]; - - /** WebDetection visuallySimilarImages. */ - public visuallySimilarImages: google.cloud.vision.v1.WebDetection.IWebImage[]; - - /** WebDetection bestGuessLabels. */ - public bestGuessLabels: google.cloud.vision.v1.WebDetection.IWebLabel[]; - - /** - * Creates a new WebDetection instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetection instance - */ - public static create(properties?: google.cloud.vision.v1.IWebDetection): google.cloud.vision.v1.WebDetection; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetection message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebDetection message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebDetection - * @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.WebDetection; - - /** - * Decodes a WebDetection message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebDetection - * @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.WebDetection; - - /** - * Verifies a WebDetection 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 WebDetection message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetection - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.WebDetection; - - /** - * Creates a plain object from a WebDetection message. Also converts values to other types if specified. - * @param message WebDetection - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.WebDetection, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetection to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetection - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace WebDetection { - - /** Properties of a WebEntity. */ - interface IWebEntity { - - /** WebEntity entityId */ - entityId?: (string|null); - - /** WebEntity score */ - score?: (number|null); - - /** WebEntity description */ - description?: (string|null); - } - - /** Represents a WebEntity. */ - class WebEntity implements IWebEntity { - - /** - * Constructs a new WebEntity. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.WebDetection.IWebEntity); - - /** WebEntity entityId. */ - public entityId: string; - - /** WebEntity score. */ - public score: number; - - /** WebEntity description. */ - public description: string; - - /** - * Creates a new WebEntity instance using the specified properties. - * @param [properties] Properties to set - * @returns WebEntity instance - */ - public static create(properties?: google.cloud.vision.v1.WebDetection.IWebEntity): google.cloud.vision.v1.WebDetection.WebEntity; - - /** - * Encodes the specified WebEntity message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Verifies a WebEntity 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 WebEntity message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebEntity - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.WebDetection.WebEntity; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @param message WebEntity - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.WebDetection.WebEntity, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebEntity to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebEntity - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebImage. */ - interface IWebImage { - - /** WebImage url */ - url?: (string|null); - - /** WebImage score */ - score?: (number|null); - } - - /** Represents a WebImage. */ - class WebImage implements IWebImage { - - /** - * Constructs a new WebImage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.WebDetection.IWebImage); - - /** WebImage url. */ - public url: string; - - /** WebImage score. */ - public score: number; - - /** - * Creates a new WebImage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebImage instance - */ - public static create(properties?: google.cloud.vision.v1.WebDetection.IWebImage): google.cloud.vision.v1.WebDetection.WebImage; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Verifies a WebImage 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 WebImage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebImage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.WebDetection.WebImage; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @param message WebImage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.WebDetection.WebImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebImage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebImage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebPage. */ - interface IWebPage { - - /** WebPage url */ - url?: (string|null); - - /** WebPage score */ - score?: (number|null); - - /** WebPage pageTitle */ - pageTitle?: (string|null); - - /** WebPage fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1.WebDetection.IWebImage[]|null); - - /** WebPage partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1.WebDetection.IWebImage[]|null); - } - - /** Represents a WebPage. */ - class WebPage implements IWebPage { - - /** - * Constructs a new WebPage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.WebDetection.IWebPage); - - /** WebPage url. */ - public url: string; - - /** WebPage score. */ - public score: number; - - /** WebPage pageTitle. */ - public pageTitle: string; - - /** WebPage fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1.WebDetection.IWebImage[]; - - /** WebPage partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1.WebDetection.IWebImage[]; - - /** - * Creates a new WebPage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebPage instance - */ - public static create(properties?: google.cloud.vision.v1.WebDetection.IWebPage): google.cloud.vision.v1.WebDetection.WebPage; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Verifies a WebPage 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 WebPage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebPage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.WebDetection.WebPage; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @param message WebPage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.WebDetection.WebPage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebPage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebPage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebLabel. */ - interface IWebLabel { - - /** WebLabel label */ - label?: (string|null); - - /** WebLabel languageCode */ - languageCode?: (string|null); - } - - /** Represents a WebLabel. */ - class WebLabel implements IWebLabel { - - /** - * Constructs a new WebLabel. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.WebDetection.IWebLabel); - - /** WebLabel label. */ - public label: string; - - /** WebLabel languageCode. */ - public languageCode: string; - - /** - * Creates a new WebLabel instance using the specified properties. - * @param [properties] Properties to set - * @returns WebLabel instance - */ - public static create(properties?: google.cloud.vision.v1.WebDetection.IWebLabel): google.cloud.vision.v1.WebDetection.WebLabel; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Verifies a WebLabel 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 WebLabel message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebLabel - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.WebDetection.WebLabel; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @param message WebLabel - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.WebDetection.WebLabel, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebLabel to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebLabel - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - - /** 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 }; - - /** - * Gets the default type url for Vertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for BoundingPoly - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for Position - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** - * 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; - - /** - * 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.v1p1beta1.IBatchAnnotateImagesRequest, callback: google.cloud.vision.v1p1beta1.ImageAnnotator.BatchAnnotateImagesCallback): void; - - /** - * Calls BatchAnnotateImages. - * @param request BatchAnnotateImagesRequest message or plain object - * @returns Promise - */ - public batchAnnotateImages(request: google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest): Promise; - } - - namespace ImageAnnotator { - - /** - * Callback as used by {@link google.cloud.vision.v1p1beta1.ImageAnnotator|batchAnnotateImages}. - * @param error Error, if any - * @param [response] BatchAnnotateImagesResponse - */ - type BatchAnnotateImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse) => void; - } - - /** Properties of a Feature. */ - interface IFeature { - - /** Feature type */ - type?: (google.cloud.vision.v1p1beta1.Feature.Type|keyof typeof google.cloud.vision.v1p1beta1.Feature.Type|null); - - /** Feature maxResults */ - maxResults?: (number|null); - - /** Feature model */ - model?: (string|null); - } - - /** Represents a Feature. */ - class Feature implements IFeature { - - /** - * Constructs a new Feature. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IFeature); - - /** Feature type. */ - public type: (google.cloud.vision.v1p1beta1.Feature.Type|keyof typeof google.cloud.vision.v1p1beta1.Feature.Type); - - /** Feature maxResults. */ - public maxResults: number; - - /** Feature model. */ - public model: string; - - /** - * Creates a new Feature instance using the specified properties. - * @param [properties] Properties to set - * @returns Feature instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IFeature): google.cloud.vision.v1p1beta1.Feature; - - /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.Feature; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.Feature; - - /** - * 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 Feature message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Feature - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Feature; - - /** - * 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.v1p1beta1.Feature, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Feature to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Feature - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 - } - } - - /** Properties of an ImageSource. */ - interface IImageSource { - - /** ImageSource gcsImageUri */ - gcsImageUri?: (string|null); - - /** ImageSource imageUri */ - imageUri?: (string|null); - } - - /** Represents an ImageSource. */ - class ImageSource implements IImageSource { - - /** - * Constructs a new ImageSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IImageSource); - - /** ImageSource gcsImageUri. */ - public gcsImageUri: string; - - /** ImageSource imageUri. */ - public imageUri: string; - - /** - * Creates a new ImageSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageSource instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IImageSource): google.cloud.vision.v1p1beta1.ImageSource; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.ImageSource; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.ImageSource; - - /** - * 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 an ImageSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.ImageSource; - - /** - * 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.v1p1beta1.ImageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Image. */ - interface IImage { - - /** Image content */ - content?: (Uint8Array|string|null); - - /** Image source */ - source?: (google.cloud.vision.v1p1beta1.IImageSource|null); - } - - /** Represents an Image. */ - class Image implements IImage { - - /** - * Constructs a new Image. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IImage); - - /** Image content. */ - public content: (Uint8Array|string); - - /** Image source. */ - public source?: (google.cloud.vision.v1p1beta1.IImageSource|null); - - /** - * Creates a new Image instance using the specified properties. - * @param [properties] Properties to set - * @returns Image instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IImage): google.cloud.vision.v1p1beta1.Image; - - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.Image; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.Image; - - /** - * 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 an Image message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Image - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Image; - - /** - * 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.v1p1beta1.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Image to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Image - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FaceAnnotation. */ - interface IFaceAnnotation { - - /** FaceAnnotation boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly */ - fdBoundingPoly?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** FaceAnnotation landmarks */ - landmarks?: (google.cloud.vision.v1p1beta1.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.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** FaceAnnotation sorrowLikelihood */ - sorrowLikelihood?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** FaceAnnotation angerLikelihood */ - angerLikelihood?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** FaceAnnotation surpriseLikelihood */ - surpriseLikelihood?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** FaceAnnotation underExposedLikelihood */ - underExposedLikelihood?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** FaceAnnotation blurredLikelihood */ - blurredLikelihood?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** FaceAnnotation headwearLikelihood */ - headwearLikelihood?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - } - - /** Represents a FaceAnnotation. */ - class FaceAnnotation implements IFaceAnnotation { - - /** - * Constructs a new FaceAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IFaceAnnotation); - - /** FaceAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly. */ - public fdBoundingPoly?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** FaceAnnotation landmarks. */ - public landmarks: google.cloud.vision.v1p1beta1.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.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** FaceAnnotation sorrowLikelihood. */ - public sorrowLikelihood: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** FaceAnnotation angerLikelihood. */ - public angerLikelihood: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** FaceAnnotation surpriseLikelihood. */ - public surpriseLikelihood: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** FaceAnnotation underExposedLikelihood. */ - public underExposedLikelihood: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** FaceAnnotation blurredLikelihood. */ - public blurredLikelihood: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** FaceAnnotation headwearLikelihood. */ - public headwearLikelihood: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** - * Creates a new FaceAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns FaceAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IFaceAnnotation): google.cloud.vision.v1p1beta1.FaceAnnotation; - - /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.FaceAnnotation; - - /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.FaceAnnotation; - - /** - * 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 FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FaceAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.FaceAnnotation; - - /** - * 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.v1p1beta1.FaceAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FaceAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FaceAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FaceAnnotation { - - /** Properties of a Landmark. */ - interface ILandmark { - - /** Landmark type */ - type?: (google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type|null); - - /** Landmark position */ - position?: (google.cloud.vision.v1p1beta1.IPosition|null); - } - - /** Represents a Landmark. */ - class Landmark implements ILandmark { - - /** - * Constructs a new Landmark. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark); - - /** Landmark type. */ - public type: (google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type); - - /** Landmark position. */ - public position?: (google.cloud.vision.v1p1beta1.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.v1p1beta1.FaceAnnotation.ILandmark): google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark; - - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.FaceAnnotation.ILandmark, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.FaceAnnotation.Landmark, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Landmark to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Landmark - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 LocationInfo. */ - interface ILocationInfo { - - /** LocationInfo latLng */ - latLng?: (google.type.ILatLng|null); - } - - /** Represents a LocationInfo. */ - class LocationInfo implements ILocationInfo { - - /** - * Constructs a new LocationInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ILocationInfo); - - /** LocationInfo latLng. */ - public latLng?: (google.type.ILatLng|null); - - /** - * Creates a new LocationInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns LocationInfo instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ILocationInfo): google.cloud.vision.v1p1beta1.LocationInfo; - - /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LocationInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p1beta1.LocationInfo; - - /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p1beta1.LocationInfo; - - /** - * Verifies a LocationInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocationInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.LocationInfo; - - /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @param message LocationInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocationInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocationInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Property. */ - interface IProperty { - - /** Property name */ - name?: (string|null); - - /** Property value */ - value?: (string|null); - - /** Property uint64Value */ - uint64Value?: (number|Long|string|null); - } - - /** Represents a Property. */ - class Property implements IProperty { - - /** - * Constructs a new Property. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IProperty); - - /** Property name. */ - public name: string; - - /** Property value. */ - public value: string; - - /** Property uint64Value. */ - public uint64Value: (number|Long|string); - - /** - * Creates a new Property instance using the specified properties. - * @param [properties] Properties to set - * @returns Property instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IProperty): google.cloud.vision.v1p1beta1.Property; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Property message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p1beta1.Property; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p1beta1.Property; - - /** - * Verifies a Property message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Property - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Property; - - /** - * 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.v1p1beta1.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Property to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Property - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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.v1p1beta1.IBoundingPoly|null); - - /** EntityAnnotation locations */ - locations?: (google.cloud.vision.v1p1beta1.ILocationInfo[]|null); - - /** EntityAnnotation properties */ - properties?: (google.cloud.vision.v1p1beta1.IProperty[]|null); - } - - /** Represents an EntityAnnotation. */ - class EntityAnnotation implements IEntityAnnotation { - - /** - * Constructs a new EntityAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.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; - - /** EntityAnnotation topicality. */ - public topicality: number; - - /** EntityAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** EntityAnnotation locations. */ - public locations: google.cloud.vision.v1p1beta1.ILocationInfo[]; - - /** EntityAnnotation properties. */ - public properties: google.cloud.vision.v1p1beta1.IProperty[]; - - /** - * Creates a new EntityAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns EntityAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IEntityAnnotation): google.cloud.vision.v1p1beta1.EntityAnnotation; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p1beta1.EntityAnnotation; - - /** - * 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 - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p1beta1.EntityAnnotation; - - /** - * 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 an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EntityAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.EntityAnnotation; - - /** - * 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.v1p1beta1.EntityAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EntityAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EntityAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SafeSearchAnnotation. */ - interface ISafeSearchAnnotation { - - /** SafeSearchAnnotation adult */ - adult?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** SafeSearchAnnotation spoof */ - spoof?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** SafeSearchAnnotation medical */ - medical?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** SafeSearchAnnotation violence */ - violence?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - - /** SafeSearchAnnotation racy */ - racy?: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood|null); - } - - /** Represents a SafeSearchAnnotation. */ - class SafeSearchAnnotation implements ISafeSearchAnnotation { - - /** - * Constructs a new SafeSearchAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ISafeSearchAnnotation); - - /** SafeSearchAnnotation adult. */ - public adult: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** SafeSearchAnnotation spoof. */ - public spoof: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** SafeSearchAnnotation medical. */ - public medical: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** SafeSearchAnnotation violence. */ - public violence: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** SafeSearchAnnotation racy. */ - public racy: (google.cloud.vision.v1p1beta1.Likelihood|keyof typeof google.cloud.vision.v1p1beta1.Likelihood); - - /** - * Creates a new SafeSearchAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns SafeSearchAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ISafeSearchAnnotation): google.cloud.vision.v1p1beta1.SafeSearchAnnotation; - - /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.SafeSearchAnnotation; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.SafeSearchAnnotation; - - /** - * 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 SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SafeSearchAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.SafeSearchAnnotation; - - /** - * 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.v1p1beta1.SafeSearchAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LatLongRect. */ - interface ILatLongRect { - - /** LatLongRect minLatLng */ - minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng */ - maxLatLng?: (google.type.ILatLng|null); - } - - /** Represents a LatLongRect. */ - class LatLongRect implements ILatLongRect { - - /** - * Constructs a new LatLongRect. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ILatLongRect); - - /** LatLongRect minLatLng. */ - public minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng. */ - public maxLatLng?: (google.type.ILatLng|null); - - /** - * Creates a new LatLongRect instance using the specified properties. - * @param [properties] Properties to set - * @returns LatLongRect instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ILatLongRect): google.cloud.vision.v1p1beta1.LatLongRect; - - /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.LatLongRect; - - /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.LatLongRect; - - /** - * 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 LatLongRect message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LatLongRect - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.LatLongRect; - - /** - * 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.v1p1beta1.LatLongRect, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LatLongRect to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LatLongRect - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ColorInfo. */ - interface IColorInfo { - - /** ColorInfo color */ - color?: (google.type.IColor|null); - - /** ColorInfo score */ - score?: (number|null); - - /** ColorInfo pixelFraction */ - pixelFraction?: (number|null); - } - - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { - - /** - * Constructs a new ColorInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IColorInfo); - - /** ColorInfo color. */ - public color?: (google.type.IColor|null); - - /** ColorInfo score. */ - public score: number; - - /** ColorInfo pixelFraction. */ - public pixelFraction: number; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns ColorInfo instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IColorInfo): google.cloud.vision.v1p1beta1.ColorInfo; - - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.ColorInfo; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.ColorInfo; - - /** - * 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 a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ColorInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.ColorInfo; - - /** - * 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.v1p1beta1.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ColorInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ColorInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DominantColorsAnnotation. */ - interface IDominantColorsAnnotation { - - /** DominantColorsAnnotation colors */ - colors?: (google.cloud.vision.v1p1beta1.IColorInfo[]|null); - } - - /** Represents a DominantColorsAnnotation. */ - class DominantColorsAnnotation implements IDominantColorsAnnotation { - - /** - * Constructs a new DominantColorsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IDominantColorsAnnotation); - - /** DominantColorsAnnotation colors. */ - public colors: google.cloud.vision.v1p1beta1.IColorInfo[]; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns DominantColorsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IDominantColorsAnnotation): google.cloud.vision.v1p1beta1.DominantColorsAnnotation; - - /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.DominantColorsAnnotation; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.DominantColorsAnnotation; - - /** - * 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 a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DominantColorsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.DominantColorsAnnotation; - - /** - * 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.v1p1beta1.DominantColorsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageProperties. */ - interface IImageProperties { - - /** ImageProperties dominantColors */ - dominantColors?: (google.cloud.vision.v1p1beta1.IDominantColorsAnnotation|null); - } - - /** Represents an ImageProperties. */ - class ImageProperties implements IImageProperties { - - /** - * Constructs a new ImageProperties. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IImageProperties); - - /** ImageProperties dominantColors. */ - public dominantColors?: (google.cloud.vision.v1p1beta1.IDominantColorsAnnotation|null); - - /** - * Creates a new ImageProperties instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageProperties instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IImageProperties): google.cloud.vision.v1p1beta1.ImageProperties; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 ImageProperties - * @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.ImageProperties; - - /** - * 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.v1p1beta1.ImageProperties; - - /** - * Verifies an ImageProperties 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. - * @param object Plain object - * @returns ImageProperties - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.ImageProperties; - - /** - * 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.v1p1beta1.ImageProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageProperties to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageProperties - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHint. */ - interface ICropHint { - - /** CropHint boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** CropHint confidence */ - confidence?: (number|null); - - /** CropHint importanceFraction */ - importanceFraction?: (number|null); - } - - /** Represents a CropHint. */ - class CropHint implements ICropHint { - - /** - * Constructs a new CropHint. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ICropHint); - - /** CropHint boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** CropHint confidence. */ - public confidence: number; - - /** CropHint importanceFraction. */ - public importanceFraction: number; - - /** - * Creates a new CropHint instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHint instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ICropHint): google.cloud.vision.v1p1beta1.CropHint; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.CropHint; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.CropHint; - - /** - * 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 a CropHint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHint - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.CropHint; - - /** - * 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.v1p1beta1.CropHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsAnnotation. */ - interface ICropHintsAnnotation { - - /** CropHintsAnnotation cropHints */ - cropHints?: (google.cloud.vision.v1p1beta1.ICropHint[]|null); - } - - /** Represents a CropHintsAnnotation. */ - class CropHintsAnnotation implements ICropHintsAnnotation { - - /** - * Constructs a new CropHintsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ICropHintsAnnotation); - - /** CropHintsAnnotation cropHints. */ - public cropHints: google.cloud.vision.v1p1beta1.ICropHint[]; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ICropHintsAnnotation): google.cloud.vision.v1p1beta1.CropHintsAnnotation; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.CropHintsAnnotation; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.CropHintsAnnotation; - - /** - * 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 CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.CropHintsAnnotation; - - /** - * 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.v1p1beta1.CropHintsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsParams. */ - interface ICropHintsParams { - - /** CropHintsParams aspectRatios */ - aspectRatios?: (number[]|null); - } - - /** Represents a CropHintsParams. */ - class CropHintsParams implements ICropHintsParams { - - /** - * Constructs a new CropHintsParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ICropHintsParams); - - /** CropHintsParams aspectRatios. */ - public aspectRatios: number[]; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsParams instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ICropHintsParams): google.cloud.vision.v1p1beta1.CropHintsParams; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.CropHintsParams; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.CropHintsParams; - - /** - * 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 CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.CropHintsParams; - - /** - * 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.v1p1beta1.CropHintsParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetectionParams. */ - interface IWebDetectionParams { - - /** WebDetectionParams includeGeoResults */ - includeGeoResults?: (boolean|null); - } - - /** Represents a WebDetectionParams. */ - class WebDetectionParams implements IWebDetectionParams { - - /** - * Constructs a new WebDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IWebDetectionParams); - - /** WebDetectionParams includeGeoResults. */ - public includeGeoResults: boolean; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IWebDetectionParams): google.cloud.vision.v1p1beta1.WebDetectionParams; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.WebDetectionParams; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.WebDetectionParams; - - /** - * 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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.WebDetectionParams; - - /** - * 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.v1p1beta1.WebDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TextDetectionParams. */ - interface ITextDetectionParams { - - /** TextDetectionParams enableTextDetectionConfidenceScore */ - enableTextDetectionConfidenceScore?: (boolean|null); - - /** TextDetectionParams advancedOcrOptions */ - advancedOcrOptions?: (string[]|null); - } - - /** Represents a TextDetectionParams. */ - class TextDetectionParams implements ITextDetectionParams { - - /** - * Constructs a new TextDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ITextDetectionParams); - - /** TextDetectionParams enableTextDetectionConfidenceScore. */ - public enableTextDetectionConfidenceScore: boolean; - - /** TextDetectionParams advancedOcrOptions. */ - public advancedOcrOptions: string[]; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns TextDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ITextDetectionParams): google.cloud.vision.v1p1beta1.TextDetectionParams; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Verifies a TextDetectionParams 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 TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.TextDetectionParams; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @param message TextDetectionParams - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.TextDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageContext. */ - interface IImageContext { - - /** ImageContext latLongRect */ - latLongRect?: (google.cloud.vision.v1p1beta1.ILatLongRect|null); - - /** ImageContext languageHints */ - languageHints?: (string[]|null); - - /** ImageContext cropHintsParams */ - cropHintsParams?: (google.cloud.vision.v1p1beta1.ICropHintsParams|null); - - /** ImageContext webDetectionParams */ - webDetectionParams?: (google.cloud.vision.v1p1beta1.IWebDetectionParams|null); - - /** ImageContext textDetectionParams */ - textDetectionParams?: (google.cloud.vision.v1p1beta1.ITextDetectionParams|null); - } - - /** Represents an ImageContext. */ - class ImageContext implements IImageContext { - - /** - * Constructs a new ImageContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IImageContext); - - /** ImageContext latLongRect. */ - public latLongRect?: (google.cloud.vision.v1p1beta1.ILatLongRect|null); - - /** ImageContext languageHints. */ - public languageHints: string[]; - - /** ImageContext cropHintsParams. */ - public cropHintsParams?: (google.cloud.vision.v1p1beta1.ICropHintsParams|null); - - /** ImageContext webDetectionParams. */ - public webDetectionParams?: (google.cloud.vision.v1p1beta1.IWebDetectionParams|null); - - /** ImageContext textDetectionParams. */ - public textDetectionParams?: (google.cloud.vision.v1p1beta1.ITextDetectionParams|null); - - /** - * Creates a new ImageContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageContext instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IImageContext): google.cloud.vision.v1p1beta1.ImageContext; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.ImageContext; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.ImageContext; - - /** - * 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 ImageContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.ImageContext; - - /** - * 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.v1p1beta1.ImageContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageRequest. */ - interface IAnnotateImageRequest { - - /** AnnotateImageRequest image */ - image?: (google.cloud.vision.v1p1beta1.IImage|null); - - /** AnnotateImageRequest features */ - features?: (google.cloud.vision.v1p1beta1.IFeature[]|null); - - /** AnnotateImageRequest imageContext */ - imageContext?: (google.cloud.vision.v1p1beta1.IImageContext|null); - } - - /** Represents an AnnotateImageRequest. */ - class AnnotateImageRequest implements IAnnotateImageRequest { - - /** - * Constructs a new AnnotateImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IAnnotateImageRequest); - - /** AnnotateImageRequest image. */ - public image?: (google.cloud.vision.v1p1beta1.IImage|null); - - /** AnnotateImageRequest features. */ - public features: google.cloud.vision.v1p1beta1.IFeature[]; - - /** AnnotateImageRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p1beta1.IImageContext|null); - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IAnnotateImageRequest): google.cloud.vision.v1p1beta1.AnnotateImageRequest; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.AnnotateImageRequest; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.AnnotateImageRequest; - - /** - * 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 an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.AnnotateImageRequest; - - /** - * 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.v1p1beta1.AnnotateImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageResponse. */ - interface IAnnotateImageResponse { - - /** AnnotateImageResponse faceAnnotations */ - faceAnnotations?: (google.cloud.vision.v1p1beta1.IFaceAnnotation[]|null); - - /** AnnotateImageResponse landmarkAnnotations */ - landmarkAnnotations?: (google.cloud.vision.v1p1beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse logoAnnotations */ - logoAnnotations?: (google.cloud.vision.v1p1beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse labelAnnotations */ - labelAnnotations?: (google.cloud.vision.v1p1beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse textAnnotations */ - textAnnotations?: (google.cloud.vision.v1p1beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse fullTextAnnotation */ - fullTextAnnotation?: (google.cloud.vision.v1p1beta1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation */ - safeSearchAnnotation?: (google.cloud.vision.v1p1beta1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation */ - imagePropertiesAnnotation?: (google.cloud.vision.v1p1beta1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation */ - cropHintsAnnotation?: (google.cloud.vision.v1p1beta1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection */ - webDetection?: (google.cloud.vision.v1p1beta1.IWebDetection|null); - - /** AnnotateImageResponse error */ - error?: (google.rpc.IStatus|null); - } - - /** Represents an AnnotateImageResponse. */ - class AnnotateImageResponse implements IAnnotateImageResponse { - - /** - * Constructs a new AnnotateImageResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IAnnotateImageResponse); - - /** AnnotateImageResponse faceAnnotations. */ - public faceAnnotations: google.cloud.vision.v1p1beta1.IFaceAnnotation[]; - - /** AnnotateImageResponse landmarkAnnotations. */ - public landmarkAnnotations: google.cloud.vision.v1p1beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse logoAnnotations. */ - public logoAnnotations: google.cloud.vision.v1p1beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse labelAnnotations. */ - public labelAnnotations: google.cloud.vision.v1p1beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse textAnnotations. */ - public textAnnotations: google.cloud.vision.v1p1beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse fullTextAnnotation. */ - public fullTextAnnotation?: (google.cloud.vision.v1p1beta1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation. */ - public safeSearchAnnotation?: (google.cloud.vision.v1p1beta1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation. */ - public imagePropertiesAnnotation?: (google.cloud.vision.v1p1beta1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation. */ - public cropHintsAnnotation?: (google.cloud.vision.v1p1beta1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection. */ - public webDetection?: (google.cloud.vision.v1p1beta1.IWebDetection|null); - - /** AnnotateImageResponse error. */ - public error?: (google.rpc.IStatus|null); - - /** - * Creates a new AnnotateImageResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageResponse instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IAnnotateImageResponse): google.cloud.vision.v1p1beta1.AnnotateImageResponse; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.AnnotateImageResponse; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.AnnotateImageResponse; - - /** - * 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 AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.AnnotateImageResponse; - - /** - * 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.v1p1beta1.AnnotateImageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesRequest. */ - interface IBatchAnnotateImagesRequest { - - /** BatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1p1beta1.IAnnotateImageRequest[]|null); - } - - /** Represents a BatchAnnotateImagesRequest. */ - class BatchAnnotateImagesRequest implements IBatchAnnotateImagesRequest { - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest); - - /** BatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1p1beta1.IAnnotateImageRequest[]; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest): google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.BatchAnnotateImagesRequest; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.BatchAnnotateImagesRequest; - - /** - * 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 a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest; - - /** - * 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.v1p1beta1.BatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesResponse. */ - interface IBatchAnnotateImagesResponse { - - /** BatchAnnotateImagesResponse responses */ - responses?: (google.cloud.vision.v1p1beta1.IAnnotateImageResponse[]|null); - } - - /** Represents a BatchAnnotateImagesResponse. */ - class BatchAnnotateImagesResponse implements IBatchAnnotateImagesResponse { - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse); - - /** BatchAnnotateImagesResponse responses. */ - public responses: google.cloud.vision.v1p1beta1.IAnnotateImageResponse[]; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse): google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse; - - /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.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.v1p1beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p1beta1.BatchAnnotateImagesResponse; - - /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p1beta1.BatchAnnotateImagesResponse; - - /** - * 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 a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse; - - /** - * 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.v1p1beta1.BatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Likelihood enum. */ - enum Likelihood { - UNKNOWN = 0, - VERY_UNLIKELY = 1, - UNLIKELY = 2, - POSSIBLE = 3, - LIKELY = 4, - VERY_LIKELY = 5 - } - - /** Properties of a TextAnnotation. */ - interface ITextAnnotation { - - /** TextAnnotation pages */ - pages?: (google.cloud.vision.v1p1beta1.IPage[]|null); - - /** TextAnnotation text */ - text?: (string|null); - } - - /** Represents a TextAnnotation. */ - class TextAnnotation implements ITextAnnotation { - - /** - * Constructs a new TextAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ITextAnnotation); - - /** TextAnnotation pages. */ - public pages: google.cloud.vision.v1p1beta1.IPage[]; - - /** TextAnnotation text. */ - public text: string; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns TextAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ITextAnnotation): google.cloud.vision.v1p1beta1.TextAnnotation; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Verifies a TextAnnotation 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 TextAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.TextAnnotation; - - /** - * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. - * @param message TextAnnotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.TextAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace TextAnnotation { - - /** Properties of a DetectedLanguage. */ - interface IDetectedLanguage { - - /** DetectedLanguage languageCode */ - languageCode?: (string|null); - - /** DetectedLanguage confidence */ - confidence?: (number|null); - } - - /** Represents a DetectedLanguage. */ - class DetectedLanguage implements IDetectedLanguage { - - /** - * Constructs a new DetectedLanguage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage); - - /** DetectedLanguage languageCode. */ - public languageCode: string; - - /** DetectedLanguage confidence. */ - public confidence: number; - - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedLanguage instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage): google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage; - - /** - * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Verifies a DetectedLanguage 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 DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedLanguage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @param message DetectedLanguage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedLanguage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedLanguage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DetectedBreak. */ - interface IDetectedBreak { - - /** DetectedBreak type */ - type?: (google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType|null); - - /** DetectedBreak isPrefix */ - isPrefix?: (boolean|null); - } - - /** Represents a DetectedBreak. */ - class DetectedBreak implements IDetectedBreak { - - /** - * Constructs a new DetectedBreak. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak); - - /** DetectedBreak type. */ - public type: (google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType); - - /** DetectedBreak isPrefix. */ - public isPrefix: boolean; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedBreak instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak): google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Verifies a DetectedBreak 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 DetectedBreak message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedBreak - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak; - - /** - * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. - * @param message DetectedBreak - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedBreak to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedBreak - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DetectedBreak { - - /** BreakType enum. */ - enum BreakType { - UNKNOWN = 0, - SPACE = 1, - SURE_SPACE = 2, - EOL_SURE_SPACE = 3, - HYPHEN = 4, - LINE_BREAK = 5 - } - } - - /** Properties of a TextProperty. */ - interface ITextProperty { - - /** TextProperty detectedLanguages */ - detectedLanguages?: (google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage[]|null); - - /** TextProperty detectedBreak */ - detectedBreak?: (google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak|null); - } - - /** Represents a TextProperty. */ - class TextProperty implements ITextProperty { - - /** - * Constructs a new TextProperty. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty); - - /** TextProperty detectedLanguages. */ - public detectedLanguages: google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage[]; - - /** TextProperty detectedBreak. */ - public detectedBreak?: (google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak|null); - - /** - * Creates a new TextProperty instance using the specified properties. - * @param [properties] Properties to set - * @returns TextProperty instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty): google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty; - - /** - * Encodes the specified TextProperty message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextProperty message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextProperty message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Decodes a TextProperty message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Verifies a TextProperty 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 TextProperty message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextProperty - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty; - - /** - * Creates a plain object from a TextProperty message. Also converts values to other types if specified. - * @param message TextProperty - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextProperty to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextProperty - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a Page. */ - interface IPage { - - /** Page property */ - property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Page width */ - width?: (number|null); - - /** Page height */ - height?: (number|null); - - /** Page blocks */ - blocks?: (google.cloud.vision.v1p1beta1.IBlock[]|null); - - /** Page confidence */ - confidence?: (number|null); - } - - /** Represents a Page. */ - class Page implements IPage { - - /** - * Constructs a new Page. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IPage); - - /** Page property. */ - public property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Page width. */ - public width: number; - - /** Page height. */ - public height: number; - - /** Page blocks. */ - public blocks: google.cloud.vision.v1p1beta1.IBlock[]; - - /** Page confidence. */ - public confidence: number; - - /** - * Creates a new Page instance using the specified properties. - * @param [properties] Properties to set - * @returns Page instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IPage): google.cloud.vision.v1p1beta1.Page; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Page message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Page - * @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.Page; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Page - * @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.Page; - - /** - * Verifies a Page 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 Page message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Page - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Page; - - /** - * Creates a plain object from a Page message. Also converts values to other types if specified. - * @param message Page - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Page to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Page - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Block. */ - interface IBlock { - - /** Block property */ - property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox */ - boundingBox?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** Block paragraphs */ - paragraphs?: (google.cloud.vision.v1p1beta1.IParagraph[]|null); - - /** Block blockType */ - blockType?: (google.cloud.vision.v1p1beta1.Block.BlockType|keyof typeof google.cloud.vision.v1p1beta1.Block.BlockType|null); - - /** Block confidence */ - confidence?: (number|null); - } - - /** Represents a Block. */ - class Block implements IBlock { - - /** - * Constructs a new Block. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IBlock); - - /** Block property. */ - public property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** Block paragraphs. */ - public paragraphs: google.cloud.vision.v1p1beta1.IParagraph[]; - - /** Block blockType. */ - public blockType: (google.cloud.vision.v1p1beta1.Block.BlockType|keyof typeof google.cloud.vision.v1p1beta1.Block.BlockType); - - /** Block confidence. */ - public confidence: number; - - /** - * Creates a new Block instance using the specified properties. - * @param [properties] Properties to set - * @returns Block instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IBlock): google.cloud.vision.v1p1beta1.Block; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Block message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Block - * @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.Block; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Block - * @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.Block; - - /** - * Verifies a Block 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 Block message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Block - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Block; - - /** - * Creates a plain object from a Block message. Also converts values to other types if specified. - * @param message Block - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Block to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Block - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Block { - - /** BlockType enum. */ - enum BlockType { - UNKNOWN = 0, - TEXT = 1, - TABLE = 2, - PICTURE = 3, - RULER = 4, - BARCODE = 5 - } - } - - /** Properties of a Paragraph. */ - interface IParagraph { - - /** Paragraph property */ - property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox */ - boundingBox?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** Paragraph words */ - words?: (google.cloud.vision.v1p1beta1.IWord[]|null); - - /** Paragraph confidence */ - confidence?: (number|null); - } - - /** Represents a Paragraph. */ - class Paragraph implements IParagraph { - - /** - * Constructs a new Paragraph. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IParagraph); - - /** Paragraph property. */ - public property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** Paragraph words. */ - public words: google.cloud.vision.v1p1beta1.IWord[]; - - /** Paragraph confidence. */ - public confidence: number; - - /** - * Creates a new Paragraph instance using the specified properties. - * @param [properties] Properties to set - * @returns Paragraph instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IParagraph): google.cloud.vision.v1p1beta1.Paragraph; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Paragraph message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Paragraph - * @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.Paragraph; - - /** - * Decodes a Paragraph message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Paragraph - * @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.Paragraph; - - /** - * Verifies a Paragraph 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 Paragraph message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Paragraph - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Paragraph; - - /** - * Creates a plain object from a Paragraph message. Also converts values to other types if specified. - * @param message Paragraph - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Paragraph to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Paragraph - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Word. */ - interface IWord { - - /** Word property */ - property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox */ - boundingBox?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** Word symbols */ - symbols?: (google.cloud.vision.v1p1beta1.ISymbol[]|null); - - /** Word confidence */ - confidence?: (number|null); - } - - /** Represents a Word. */ - class Word implements IWord { - - /** - * Constructs a new Word. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IWord); - - /** Word property. */ - public property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** Word symbols. */ - public symbols: google.cloud.vision.v1p1beta1.ISymbol[]; - - /** Word confidence. */ - public confidence: number; - - /** - * Creates a new Word instance using the specified properties. - * @param [properties] Properties to set - * @returns Word instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IWord): google.cloud.vision.v1p1beta1.Word; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Word message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Word message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Word - * @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.Word; - - /** - * Decodes a Word message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Word - * @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.Word; - - /** - * Verifies a Word 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 Word message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Word - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Word; - - /** - * Creates a plain object from a Word message. Also converts values to other types if specified. - * @param message Word - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.Word, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Word to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Word - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Symbol. */ - interface ISymbol { - - /** Symbol property */ - property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox */ - boundingBox?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** Symbol text */ - text?: (string|null); - - /** Symbol confidence */ - confidence?: (number|null); - } - - /** Represents a Symbol. */ - class Symbol implements ISymbol { - - /** - * Constructs a new Symbol. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.ISymbol); - - /** Symbol property. */ - public property?: (google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p1beta1.IBoundingPoly|null); - - /** Symbol text. */ - public text: string; - - /** Symbol confidence. */ - public confidence: number; - - /** - * Creates a new Symbol instance using the specified properties. - * @param [properties] Properties to set - * @returns Symbol instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.ISymbol): google.cloud.vision.v1p1beta1.Symbol; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Symbol message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p1beta1.Symbol; - - /** - * Decodes a Symbol message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p1beta1.Symbol; - - /** - * Verifies a Symbol message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Symbol message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Symbol - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Symbol; - - /** - * Creates a plain object from a Symbol message. Also converts values to other types if specified. - * @param message Symbol - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Symbol to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Symbol - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetection. */ - interface IWebDetection { - - /** WebDetection webEntities */ - webEntities?: (google.cloud.vision.v1p1beta1.WebDetection.IWebEntity[]|null); - - /** WebDetection fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]|null); - - /** WebDetection partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]|null); - - /** WebDetection pagesWithMatchingImages */ - pagesWithMatchingImages?: (google.cloud.vision.v1p1beta1.WebDetection.IWebPage[]|null); - - /** WebDetection visuallySimilarImages */ - visuallySimilarImages?: (google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]|null); - - /** WebDetection bestGuessLabels */ - bestGuessLabels?: (google.cloud.vision.v1p1beta1.WebDetection.IWebLabel[]|null); - } - - /** Represents a WebDetection. */ - class WebDetection implements IWebDetection { - - /** - * Constructs a new WebDetection. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IWebDetection); - - /** WebDetection webEntities. */ - public webEntities: google.cloud.vision.v1p1beta1.WebDetection.IWebEntity[]; - - /** WebDetection fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]; - - /** WebDetection partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]; - - /** WebDetection pagesWithMatchingImages. */ - public pagesWithMatchingImages: google.cloud.vision.v1p1beta1.WebDetection.IWebPage[]; - - /** WebDetection visuallySimilarImages. */ - public visuallySimilarImages: google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]; - - /** WebDetection bestGuessLabels. */ - public bestGuessLabels: google.cloud.vision.v1p1beta1.WebDetection.IWebLabel[]; - - /** - * Creates a new WebDetection instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetection instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IWebDetection): google.cloud.vision.v1p1beta1.WebDetection; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetection message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebDetection message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebDetection - * @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.WebDetection; - - /** - * Decodes a WebDetection message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebDetection - * @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.WebDetection; - - /** - * Verifies a WebDetection 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 WebDetection message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetection - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.WebDetection; - - /** - * Creates a plain object from a WebDetection message. Also converts values to other types if specified. - * @param message WebDetection - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.WebDetection, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetection to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetection - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace WebDetection { - - /** Properties of a WebEntity. */ - interface IWebEntity { - - /** WebEntity entityId */ - entityId?: (string|null); - - /** WebEntity score */ - score?: (number|null); - - /** WebEntity description */ - description?: (string|null); - } - - /** Represents a WebEntity. */ - class WebEntity implements IWebEntity { - - /** - * Constructs a new WebEntity. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.WebDetection.IWebEntity); - - /** WebEntity entityId. */ - public entityId: string; - - /** WebEntity score. */ - public score: number; - - /** WebEntity description. */ - public description: string; - - /** - * Creates a new WebEntity instance using the specified properties. - * @param [properties] Properties to set - * @returns WebEntity instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.WebDetection.IWebEntity): google.cloud.vision.v1p1beta1.WebDetection.WebEntity; - - /** - * Encodes the specified WebEntity message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Verifies a WebEntity 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 WebEntity message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebEntity - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.WebDetection.WebEntity; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @param message WebEntity - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.WebDetection.WebEntity, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebEntity to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebEntity - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebImage. */ - interface IWebImage { - - /** WebImage url */ - url?: (string|null); - - /** WebImage score */ - score?: (number|null); - } - - /** Represents a WebImage. */ - class WebImage implements IWebImage { - - /** - * Constructs a new WebImage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.WebDetection.IWebImage); - - /** WebImage url. */ - public url: string; - - /** WebImage score. */ - public score: number; - - /** - * Creates a new WebImage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebImage instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.WebDetection.IWebImage): google.cloud.vision.v1p1beta1.WebDetection.WebImage; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Verifies a WebImage 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 WebImage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebImage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.WebDetection.WebImage; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @param message WebImage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.WebDetection.WebImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebImage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebImage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebPage. */ - interface IWebPage { - - /** WebPage url */ - url?: (string|null); - - /** WebPage score */ - score?: (number|null); - - /** WebPage pageTitle */ - pageTitle?: (string|null); - - /** WebPage fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]|null); - - /** WebPage partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]|null); - } - - /** Represents a WebPage. */ - class WebPage implements IWebPage { - - /** - * Constructs a new WebPage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.WebDetection.IWebPage); - - /** WebPage url. */ - public url: string; - - /** WebPage score. */ - public score: number; - - /** WebPage pageTitle. */ - public pageTitle: string; - - /** WebPage fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]; - - /** WebPage partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1p1beta1.WebDetection.IWebImage[]; - - /** - * Creates a new WebPage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebPage instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.WebDetection.IWebPage): google.cloud.vision.v1p1beta1.WebDetection.WebPage; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Verifies a WebPage 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 WebPage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebPage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.WebDetection.WebPage; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @param message WebPage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.WebDetection.WebPage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebPage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebPage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebLabel. */ - interface IWebLabel { - - /** WebLabel label */ - label?: (string|null); - - /** WebLabel languageCode */ - languageCode?: (string|null); - } - - /** Represents a WebLabel. */ - class WebLabel implements IWebLabel { - - /** - * Constructs a new WebLabel. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.WebDetection.IWebLabel); - - /** WebLabel label. */ - public label: string; - - /** WebLabel languageCode. */ - public languageCode: string; - - /** - * Creates a new WebLabel instance using the specified properties. - * @param [properties] Properties to set - * @returns WebLabel instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.WebDetection.IWebLabel): google.cloud.vision.v1p1beta1.WebDetection.WebLabel; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Verifies a WebLabel 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 WebLabel message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebLabel - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.WebDetection.WebLabel; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @param message WebLabel - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.WebDetection.WebLabel, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebLabel to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebLabel - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - - /** 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 }; - - /** - * Gets the default type url for Vertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for NormalizedVertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for BoundingPoly - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for Position - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** - * 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; - - /** - * 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.v1p2beta1.IBatchAnnotateImagesRequest, callback: google.cloud.vision.v1p2beta1.ImageAnnotator.BatchAnnotateImagesCallback): void; - - /** - * Calls BatchAnnotateImages. - * @param request BatchAnnotateImagesRequest message or plain object - * @returns Promise - */ - public batchAnnotateImages(request: google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest): Promise; - - /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest, callback: google.cloud.vision.v1p2beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback): void; - - /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @returns Promise - */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest): Promise; - } - - namespace ImageAnnotator { - - /** - * Callback as used by {@link google.cloud.vision.v1p2beta1.ImageAnnotator|batchAnnotateImages}. - * @param error Error, if any - * @param [response] BatchAnnotateImagesResponse - */ - type BatchAnnotateImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p2beta1.ImageAnnotator|asyncBatchAnnotateFiles}. - * @param error Error, if any - * @param [response] Operation - */ - type AsyncBatchAnnotateFilesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a Feature. */ - interface IFeature { - - /** Feature type */ - type?: (google.cloud.vision.v1p2beta1.Feature.Type|keyof typeof google.cloud.vision.v1p2beta1.Feature.Type|null); - - /** Feature maxResults */ - maxResults?: (number|null); - - /** Feature model */ - model?: (string|null); - } - - /** Represents a Feature. */ - class Feature implements IFeature { - - /** - * Constructs a new Feature. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IFeature); - - /** Feature type. */ - public type: (google.cloud.vision.v1p2beta1.Feature.Type|keyof typeof google.cloud.vision.v1p2beta1.Feature.Type); - - /** Feature maxResults. */ - public maxResults: number; - - /** Feature model. */ - public model: string; - - /** - * Creates a new Feature instance using the specified properties. - * @param [properties] Properties to set - * @returns Feature instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IFeature): google.cloud.vision.v1p2beta1.Feature; - - /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.Feature; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.Feature; - - /** - * 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 Feature message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Feature - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Feature; - - /** - * 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.v1p2beta1.Feature, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Feature to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Feature - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 - } - } - - /** Properties of an ImageSource. */ - interface IImageSource { - - /** ImageSource gcsImageUri */ - gcsImageUri?: (string|null); - - /** ImageSource imageUri */ - imageUri?: (string|null); - } - - /** Represents an ImageSource. */ - class ImageSource implements IImageSource { - - /** - * Constructs a new ImageSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IImageSource); - - /** ImageSource gcsImageUri. */ - public gcsImageUri: string; - - /** ImageSource imageUri. */ - public imageUri: string; - - /** - * Creates a new ImageSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageSource instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IImageSource): google.cloud.vision.v1p2beta1.ImageSource; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.ImageSource; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.ImageSource; - - /** - * 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 an ImageSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.ImageSource; - - /** - * 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.v1p2beta1.ImageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Image. */ - interface IImage { - - /** Image content */ - content?: (Uint8Array|string|null); - - /** Image source */ - source?: (google.cloud.vision.v1p2beta1.IImageSource|null); - } - - /** Represents an Image. */ - class Image implements IImage { - - /** - * Constructs a new Image. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IImage); - - /** Image content. */ - public content: (Uint8Array|string); - - /** Image source. */ - public source?: (google.cloud.vision.v1p2beta1.IImageSource|null); - - /** - * Creates a new Image instance using the specified properties. - * @param [properties] Properties to set - * @returns Image instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IImage): google.cloud.vision.v1p2beta1.Image; - - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.Image; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.Image; - - /** - * 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 an Image message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Image - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Image; - - /** - * 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.v1p2beta1.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Image to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Image - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FaceAnnotation. */ - interface IFaceAnnotation { - - /** FaceAnnotation boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly */ - fdBoundingPoly?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** FaceAnnotation landmarks */ - landmarks?: (google.cloud.vision.v1p2beta1.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.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** FaceAnnotation sorrowLikelihood */ - sorrowLikelihood?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** FaceAnnotation angerLikelihood */ - angerLikelihood?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** FaceAnnotation surpriseLikelihood */ - surpriseLikelihood?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** FaceAnnotation underExposedLikelihood */ - underExposedLikelihood?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** FaceAnnotation blurredLikelihood */ - blurredLikelihood?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** FaceAnnotation headwearLikelihood */ - headwearLikelihood?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - } - - /** Represents a FaceAnnotation. */ - class FaceAnnotation implements IFaceAnnotation { - - /** - * Constructs a new FaceAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IFaceAnnotation); - - /** FaceAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly. */ - public fdBoundingPoly?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** FaceAnnotation landmarks. */ - public landmarks: google.cloud.vision.v1p2beta1.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.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** FaceAnnotation sorrowLikelihood. */ - public sorrowLikelihood: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** FaceAnnotation angerLikelihood. */ - public angerLikelihood: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** FaceAnnotation surpriseLikelihood. */ - public surpriseLikelihood: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** FaceAnnotation underExposedLikelihood. */ - public underExposedLikelihood: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** FaceAnnotation blurredLikelihood. */ - public blurredLikelihood: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** FaceAnnotation headwearLikelihood. */ - public headwearLikelihood: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** - * Creates a new FaceAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns FaceAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IFaceAnnotation): google.cloud.vision.v1p2beta1.FaceAnnotation; - - /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.FaceAnnotation; - - /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.FaceAnnotation; - - /** - * 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 FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FaceAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.FaceAnnotation; - - /** - * 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.v1p2beta1.FaceAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FaceAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FaceAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FaceAnnotation { - - /** Properties of a Landmark. */ - interface ILandmark { - - /** Landmark type */ - type?: (google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type|null); - - /** Landmark position */ - position?: (google.cloud.vision.v1p2beta1.IPosition|null); - } - - /** Represents a Landmark. */ - class Landmark implements ILandmark { - - /** - * Constructs a new Landmark. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark); - - /** Landmark type. */ - public type: (google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type); - - /** Landmark position. */ - public position?: (google.cloud.vision.v1p2beta1.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.v1p2beta1.FaceAnnotation.ILandmark): google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark; - - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.FaceAnnotation.ILandmark, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.FaceAnnotation.Landmark, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Landmark to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Landmark - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 LocationInfo. */ - interface ILocationInfo { - - /** LocationInfo latLng */ - latLng?: (google.type.ILatLng|null); - } - - /** Represents a LocationInfo. */ - class LocationInfo implements ILocationInfo { - - /** - * Constructs a new LocationInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ILocationInfo); - - /** LocationInfo latLng. */ - public latLng?: (google.type.ILatLng|null); - - /** - * Creates a new LocationInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns LocationInfo instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ILocationInfo): google.cloud.vision.v1p2beta1.LocationInfo; - - /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LocationInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p2beta1.LocationInfo; - - /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p2beta1.LocationInfo; - - /** - * Verifies a LocationInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocationInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.LocationInfo; - - /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @param message LocationInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocationInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocationInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Property. */ - interface IProperty { - - /** Property name */ - name?: (string|null); - - /** Property value */ - value?: (string|null); - - /** Property uint64Value */ - uint64Value?: (number|Long|string|null); - } - - /** Represents a Property. */ - class Property implements IProperty { - - /** - * Constructs a new Property. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IProperty); - - /** Property name. */ - public name: string; - - /** Property value. */ - public value: string; - - /** Property uint64Value. */ - public uint64Value: (number|Long|string); - - /** - * Creates a new Property instance using the specified properties. - * @param [properties] Properties to set - * @returns Property instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IProperty): google.cloud.vision.v1p2beta1.Property; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Property message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p2beta1.Property; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p2beta1.Property; - - /** - * Verifies a Property message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Property - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Property; - - /** - * 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.v1p2beta1.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Property to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Property - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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.v1p2beta1.IBoundingPoly|null); - - /** EntityAnnotation locations */ - locations?: (google.cloud.vision.v1p2beta1.ILocationInfo[]|null); - - /** EntityAnnotation properties */ - properties?: (google.cloud.vision.v1p2beta1.IProperty[]|null); - } - - /** Represents an EntityAnnotation. */ - class EntityAnnotation implements IEntityAnnotation { - - /** - * Constructs a new EntityAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.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; - - /** EntityAnnotation topicality. */ - public topicality: number; - - /** EntityAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** EntityAnnotation locations. */ - public locations: google.cloud.vision.v1p2beta1.ILocationInfo[]; - - /** EntityAnnotation properties. */ - public properties: google.cloud.vision.v1p2beta1.IProperty[]; - - /** - * Creates a new EntityAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns EntityAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IEntityAnnotation): google.cloud.vision.v1p2beta1.EntityAnnotation; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p2beta1.EntityAnnotation; - - /** - * 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 - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p2beta1.EntityAnnotation; - - /** - * 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 an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EntityAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.EntityAnnotation; - - /** - * 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.v1p2beta1.EntityAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EntityAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EntityAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SafeSearchAnnotation. */ - interface ISafeSearchAnnotation { - - /** SafeSearchAnnotation adult */ - adult?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** SafeSearchAnnotation spoof */ - spoof?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** SafeSearchAnnotation medical */ - medical?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** SafeSearchAnnotation violence */ - violence?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - - /** SafeSearchAnnotation racy */ - racy?: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood|null); - } - - /** Represents a SafeSearchAnnotation. */ - class SafeSearchAnnotation implements ISafeSearchAnnotation { - - /** - * Constructs a new SafeSearchAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ISafeSearchAnnotation); - - /** SafeSearchAnnotation adult. */ - public adult: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** SafeSearchAnnotation spoof. */ - public spoof: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** SafeSearchAnnotation medical. */ - public medical: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** SafeSearchAnnotation violence. */ - public violence: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** SafeSearchAnnotation racy. */ - public racy: (google.cloud.vision.v1p2beta1.Likelihood|keyof typeof google.cloud.vision.v1p2beta1.Likelihood); - - /** - * Creates a new SafeSearchAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns SafeSearchAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ISafeSearchAnnotation): google.cloud.vision.v1p2beta1.SafeSearchAnnotation; - - /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.SafeSearchAnnotation; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.SafeSearchAnnotation; - - /** - * 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 SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SafeSearchAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.SafeSearchAnnotation; - - /** - * 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.v1p2beta1.SafeSearchAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LatLongRect. */ - interface ILatLongRect { - - /** LatLongRect minLatLng */ - minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng */ - maxLatLng?: (google.type.ILatLng|null); - } - - /** Represents a LatLongRect. */ - class LatLongRect implements ILatLongRect { - - /** - * Constructs a new LatLongRect. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ILatLongRect); - - /** LatLongRect minLatLng. */ - public minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng. */ - public maxLatLng?: (google.type.ILatLng|null); - - /** - * Creates a new LatLongRect instance using the specified properties. - * @param [properties] Properties to set - * @returns LatLongRect instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ILatLongRect): google.cloud.vision.v1p2beta1.LatLongRect; - - /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.LatLongRect; - - /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.LatLongRect; - - /** - * 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 LatLongRect message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LatLongRect - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.LatLongRect; - - /** - * 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.v1p2beta1.LatLongRect, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LatLongRect to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LatLongRect - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ColorInfo. */ - interface IColorInfo { - - /** ColorInfo color */ - color?: (google.type.IColor|null); - - /** ColorInfo score */ - score?: (number|null); - - /** ColorInfo pixelFraction */ - pixelFraction?: (number|null); - } - - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { - - /** - * Constructs a new ColorInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IColorInfo); - - /** ColorInfo color. */ - public color?: (google.type.IColor|null); - - /** ColorInfo score. */ - public score: number; - - /** ColorInfo pixelFraction. */ - public pixelFraction: number; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns ColorInfo instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IColorInfo): google.cloud.vision.v1p2beta1.ColorInfo; - - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.ColorInfo; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.ColorInfo; - - /** - * 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 a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ColorInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.ColorInfo; - - /** - * 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.v1p2beta1.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ColorInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ColorInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DominantColorsAnnotation. */ - interface IDominantColorsAnnotation { - - /** DominantColorsAnnotation colors */ - colors?: (google.cloud.vision.v1p2beta1.IColorInfo[]|null); - } - - /** Represents a DominantColorsAnnotation. */ - class DominantColorsAnnotation implements IDominantColorsAnnotation { - - /** - * Constructs a new DominantColorsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IDominantColorsAnnotation); - - /** DominantColorsAnnotation colors. */ - public colors: google.cloud.vision.v1p2beta1.IColorInfo[]; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns DominantColorsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IDominantColorsAnnotation): google.cloud.vision.v1p2beta1.DominantColorsAnnotation; - - /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.DominantColorsAnnotation; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.DominantColorsAnnotation; - - /** - * 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 a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DominantColorsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.DominantColorsAnnotation; - - /** - * 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.v1p2beta1.DominantColorsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageProperties. */ - interface IImageProperties { - - /** ImageProperties dominantColors */ - dominantColors?: (google.cloud.vision.v1p2beta1.IDominantColorsAnnotation|null); - } - - /** Represents an ImageProperties. */ - class ImageProperties implements IImageProperties { - - /** - * Constructs a new ImageProperties. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IImageProperties); - - /** ImageProperties dominantColors. */ - public dominantColors?: (google.cloud.vision.v1p2beta1.IDominantColorsAnnotation|null); - - /** - * Creates a new ImageProperties instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageProperties instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IImageProperties): google.cloud.vision.v1p2beta1.ImageProperties; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 ImageProperties - * @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.ImageProperties; - - /** - * 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.v1p2beta1.ImageProperties; - - /** - * Verifies an ImageProperties 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. - * @param object Plain object - * @returns ImageProperties - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.ImageProperties; - - /** - * 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.v1p2beta1.ImageProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageProperties to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageProperties - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHint. */ - interface ICropHint { - - /** CropHint boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** CropHint confidence */ - confidence?: (number|null); - - /** CropHint importanceFraction */ - importanceFraction?: (number|null); - } - - /** Represents a CropHint. */ - class CropHint implements ICropHint { - - /** - * Constructs a new CropHint. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ICropHint); - - /** CropHint boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** CropHint confidence. */ - public confidence: number; - - /** CropHint importanceFraction. */ - public importanceFraction: number; - - /** - * Creates a new CropHint instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHint instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ICropHint): google.cloud.vision.v1p2beta1.CropHint; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.CropHint; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.CropHint; - - /** - * 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 a CropHint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHint - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.CropHint; - - /** - * 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.v1p2beta1.CropHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsAnnotation. */ - interface ICropHintsAnnotation { - - /** CropHintsAnnotation cropHints */ - cropHints?: (google.cloud.vision.v1p2beta1.ICropHint[]|null); - } - - /** Represents a CropHintsAnnotation. */ - class CropHintsAnnotation implements ICropHintsAnnotation { - - /** - * Constructs a new CropHintsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ICropHintsAnnotation); - - /** CropHintsAnnotation cropHints. */ - public cropHints: google.cloud.vision.v1p2beta1.ICropHint[]; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ICropHintsAnnotation): google.cloud.vision.v1p2beta1.CropHintsAnnotation; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.CropHintsAnnotation; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.CropHintsAnnotation; - - /** - * 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 CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.CropHintsAnnotation; - - /** - * 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.v1p2beta1.CropHintsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsParams. */ - interface ICropHintsParams { - - /** CropHintsParams aspectRatios */ - aspectRatios?: (number[]|null); - } - - /** Represents a CropHintsParams. */ - class CropHintsParams implements ICropHintsParams { - - /** - * Constructs a new CropHintsParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ICropHintsParams); - - /** CropHintsParams aspectRatios. */ - public aspectRatios: number[]; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsParams instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ICropHintsParams): google.cloud.vision.v1p2beta1.CropHintsParams; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.CropHintsParams; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.CropHintsParams; - - /** - * 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 CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.CropHintsParams; - - /** - * 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.v1p2beta1.CropHintsParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetectionParams. */ - interface IWebDetectionParams { - - /** WebDetectionParams includeGeoResults */ - includeGeoResults?: (boolean|null); - } - - /** Represents a WebDetectionParams. */ - class WebDetectionParams implements IWebDetectionParams { - - /** - * Constructs a new WebDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IWebDetectionParams); - - /** WebDetectionParams includeGeoResults. */ - public includeGeoResults: boolean; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IWebDetectionParams): google.cloud.vision.v1p2beta1.WebDetectionParams; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.WebDetectionParams; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.WebDetectionParams; - - /** - * 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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.WebDetectionParams; - - /** - * 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.v1p2beta1.WebDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TextDetectionParams. */ - interface ITextDetectionParams { - - /** TextDetectionParams enableTextDetectionConfidenceScore */ - enableTextDetectionConfidenceScore?: (boolean|null); - - /** TextDetectionParams advancedOcrOptions */ - advancedOcrOptions?: (string[]|null); - } - - /** Represents a TextDetectionParams. */ - class TextDetectionParams implements ITextDetectionParams { - - /** - * Constructs a new TextDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ITextDetectionParams); - - /** TextDetectionParams enableTextDetectionConfidenceScore. */ - public enableTextDetectionConfidenceScore: boolean; - - /** TextDetectionParams advancedOcrOptions. */ - public advancedOcrOptions: string[]; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns TextDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ITextDetectionParams): google.cloud.vision.v1p2beta1.TextDetectionParams; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Verifies a TextDetectionParams 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 TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.TextDetectionParams; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @param message TextDetectionParams - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.TextDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageContext. */ - interface IImageContext { - - /** ImageContext latLongRect */ - latLongRect?: (google.cloud.vision.v1p2beta1.ILatLongRect|null); - - /** ImageContext languageHints */ - languageHints?: (string[]|null); - - /** ImageContext cropHintsParams */ - cropHintsParams?: (google.cloud.vision.v1p2beta1.ICropHintsParams|null); - - /** ImageContext webDetectionParams */ - webDetectionParams?: (google.cloud.vision.v1p2beta1.IWebDetectionParams|null); - - /** ImageContext textDetectionParams */ - textDetectionParams?: (google.cloud.vision.v1p2beta1.ITextDetectionParams|null); - } - - /** Represents an ImageContext. */ - class ImageContext implements IImageContext { - - /** - * Constructs a new ImageContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IImageContext); - - /** ImageContext latLongRect. */ - public latLongRect?: (google.cloud.vision.v1p2beta1.ILatLongRect|null); - - /** ImageContext languageHints. */ - public languageHints: string[]; - - /** ImageContext cropHintsParams. */ - public cropHintsParams?: (google.cloud.vision.v1p2beta1.ICropHintsParams|null); - - /** ImageContext webDetectionParams. */ - public webDetectionParams?: (google.cloud.vision.v1p2beta1.IWebDetectionParams|null); - - /** ImageContext textDetectionParams. */ - public textDetectionParams?: (google.cloud.vision.v1p2beta1.ITextDetectionParams|null); - - /** - * Creates a new ImageContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageContext instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IImageContext): google.cloud.vision.v1p2beta1.ImageContext; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.ImageContext; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.ImageContext; - - /** - * 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 ImageContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.ImageContext; - - /** - * 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.v1p2beta1.ImageContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageRequest. */ - interface IAnnotateImageRequest { - - /** AnnotateImageRequest image */ - image?: (google.cloud.vision.v1p2beta1.IImage|null); - - /** AnnotateImageRequest features */ - features?: (google.cloud.vision.v1p2beta1.IFeature[]|null); - - /** AnnotateImageRequest imageContext */ - imageContext?: (google.cloud.vision.v1p2beta1.IImageContext|null); - } - - /** Represents an AnnotateImageRequest. */ - class AnnotateImageRequest implements IAnnotateImageRequest { - - /** - * Constructs a new AnnotateImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IAnnotateImageRequest); - - /** AnnotateImageRequest image. */ - public image?: (google.cloud.vision.v1p2beta1.IImage|null); - - /** AnnotateImageRequest features. */ - public features: google.cloud.vision.v1p2beta1.IFeature[]; - - /** AnnotateImageRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p2beta1.IImageContext|null); - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IAnnotateImageRequest): google.cloud.vision.v1p2beta1.AnnotateImageRequest; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.AnnotateImageRequest; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.AnnotateImageRequest; - - /** - * 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 an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.AnnotateImageRequest; - - /** - * 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.v1p2beta1.AnnotateImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageAnnotationContext. */ - interface IImageAnnotationContext { - - /** ImageAnnotationContext uri */ - uri?: (string|null); - - /** ImageAnnotationContext pageNumber */ - pageNumber?: (number|null); - } - - /** Represents an ImageAnnotationContext. */ - class ImageAnnotationContext implements IImageAnnotationContext { - - /** - * Constructs a new ImageAnnotationContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IImageAnnotationContext); - - /** ImageAnnotationContext uri. */ - public uri: string; - - /** ImageAnnotationContext pageNumber. */ - public pageNumber: number; - - /** - * Creates a new ImageAnnotationContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageAnnotationContext instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IImageAnnotationContext): google.cloud.vision.v1p2beta1.ImageAnnotationContext; - - /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.ImageAnnotationContext; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.ImageAnnotationContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageAnnotationContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageAnnotationContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageResponse. */ - interface IAnnotateImageResponse { - - /** AnnotateImageResponse faceAnnotations */ - faceAnnotations?: (google.cloud.vision.v1p2beta1.IFaceAnnotation[]|null); - - /** AnnotateImageResponse landmarkAnnotations */ - landmarkAnnotations?: (google.cloud.vision.v1p2beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse logoAnnotations */ - logoAnnotations?: (google.cloud.vision.v1p2beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse labelAnnotations */ - labelAnnotations?: (google.cloud.vision.v1p2beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse textAnnotations */ - textAnnotations?: (google.cloud.vision.v1p2beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse fullTextAnnotation */ - fullTextAnnotation?: (google.cloud.vision.v1p2beta1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation */ - safeSearchAnnotation?: (google.cloud.vision.v1p2beta1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation */ - imagePropertiesAnnotation?: (google.cloud.vision.v1p2beta1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation */ - cropHintsAnnotation?: (google.cloud.vision.v1p2beta1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection */ - webDetection?: (google.cloud.vision.v1p2beta1.IWebDetection|null); - - /** AnnotateImageResponse error */ - error?: (google.rpc.IStatus|null); - - /** AnnotateImageResponse context */ - context?: (google.cloud.vision.v1p2beta1.IImageAnnotationContext|null); - } - - /** Represents an AnnotateImageResponse. */ - class AnnotateImageResponse implements IAnnotateImageResponse { - - /** - * Constructs a new AnnotateImageResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IAnnotateImageResponse); - - /** AnnotateImageResponse faceAnnotations. */ - public faceAnnotations: google.cloud.vision.v1p2beta1.IFaceAnnotation[]; - - /** AnnotateImageResponse landmarkAnnotations. */ - public landmarkAnnotations: google.cloud.vision.v1p2beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse logoAnnotations. */ - public logoAnnotations: google.cloud.vision.v1p2beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse labelAnnotations. */ - public labelAnnotations: google.cloud.vision.v1p2beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse textAnnotations. */ - public textAnnotations: google.cloud.vision.v1p2beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse fullTextAnnotation. */ - public fullTextAnnotation?: (google.cloud.vision.v1p2beta1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation. */ - public safeSearchAnnotation?: (google.cloud.vision.v1p2beta1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation. */ - public imagePropertiesAnnotation?: (google.cloud.vision.v1p2beta1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation. */ - public cropHintsAnnotation?: (google.cloud.vision.v1p2beta1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection. */ - public webDetection?: (google.cloud.vision.v1p2beta1.IWebDetection|null); - - /** AnnotateImageResponse error. */ - public error?: (google.rpc.IStatus|null); - - /** AnnotateImageResponse context. */ - public context?: (google.cloud.vision.v1p2beta1.IImageAnnotationContext|null); - - /** - * Creates a new AnnotateImageResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageResponse instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IAnnotateImageResponse): google.cloud.vision.v1p2beta1.AnnotateImageResponse; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.AnnotateImageResponse; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.AnnotateImageResponse; - - /** - * 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 AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.AnnotateImageResponse; - - /** - * 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.v1p2beta1.AnnotateImageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateFileResponse. */ - interface IAnnotateFileResponse { - - /** AnnotateFileResponse inputConfig */ - inputConfig?: (google.cloud.vision.v1p2beta1.IInputConfig|null); - - /** AnnotateFileResponse responses */ - responses?: (google.cloud.vision.v1p2beta1.IAnnotateImageResponse[]|null); - } - - /** Represents an AnnotateFileResponse. */ - class AnnotateFileResponse implements IAnnotateFileResponse { - - /** - * Constructs a new AnnotateFileResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IAnnotateFileResponse); - - /** AnnotateFileResponse inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p2beta1.IInputConfig|null); - - /** AnnotateFileResponse responses. */ - public responses: google.cloud.vision.v1p2beta1.IAnnotateImageResponse[]; - - /** - * Creates a new AnnotateFileResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateFileResponse instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IAnnotateFileResponse): google.cloud.vision.v1p2beta1.AnnotateFileResponse; - - /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.AnnotateFileResponse; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.AnnotateFileResponse; - - /** - * 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 AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateFileResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.AnnotateFileResponse; - - /** - * 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.v1p2beta1.AnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateFileResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateFileResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesRequest. */ - interface IBatchAnnotateImagesRequest { - - /** BatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1p2beta1.IAnnotateImageRequest[]|null); - } - - /** Represents a BatchAnnotateImagesRequest. */ - class BatchAnnotateImagesRequest implements IBatchAnnotateImagesRequest { - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest); - - /** BatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1p2beta1.IAnnotateImageRequest[]; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest): google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.BatchAnnotateImagesRequest; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.BatchAnnotateImagesRequest; - - /** - * 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 a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest; - - /** - * 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.v1p2beta1.BatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesResponse. */ - interface IBatchAnnotateImagesResponse { - - /** BatchAnnotateImagesResponse responses */ - responses?: (google.cloud.vision.v1p2beta1.IAnnotateImageResponse[]|null); - } - - /** Represents a BatchAnnotateImagesResponse. */ - class BatchAnnotateImagesResponse implements IBatchAnnotateImagesResponse { - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse); - - /** BatchAnnotateImagesResponse responses. */ - public responses: google.cloud.vision.v1p2beta1.IAnnotateImageResponse[]; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse): google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse; - - /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.BatchAnnotateImagesResponse; - - /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.BatchAnnotateImagesResponse; - - /** - * 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 a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse; - - /** - * 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.v1p2beta1.BatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncAnnotateFileRequest. */ - interface IAsyncAnnotateFileRequest { - - /** AsyncAnnotateFileRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1p2beta1.IInputConfig|null); - - /** AsyncAnnotateFileRequest features */ - features?: (google.cloud.vision.v1p2beta1.IFeature[]|null); - - /** AsyncAnnotateFileRequest imageContext */ - imageContext?: (google.cloud.vision.v1p2beta1.IImageContext|null); - - /** AsyncAnnotateFileRequest outputConfig */ - outputConfig?: (google.cloud.vision.v1p2beta1.IOutputConfig|null); - } - - /** Represents an AsyncAnnotateFileRequest. */ - class AsyncAnnotateFileRequest implements IAsyncAnnotateFileRequest { - - /** - * Constructs a new AsyncAnnotateFileRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest); - - /** AsyncAnnotateFileRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p2beta1.IInputConfig|null); - - /** AsyncAnnotateFileRequest features. */ - public features: google.cloud.vision.v1p2beta1.IFeature[]; - - /** AsyncAnnotateFileRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p2beta1.IImageContext|null); - - /** AsyncAnnotateFileRequest outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p2beta1.IOutputConfig|null); - - /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncAnnotateFileRequest instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest): google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest; - - /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.AsyncAnnotateFileRequest; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.AsyncAnnotateFileRequest; - - /** - * 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 AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncAnnotateFileRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest; - - /** - * 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.v1p2beta1.AsyncAnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncAnnotateFileRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncAnnotateFileRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncAnnotateFileResponse. */ - interface IAsyncAnnotateFileResponse { - - /** AsyncAnnotateFileResponse outputConfig */ - outputConfig?: (google.cloud.vision.v1p2beta1.IOutputConfig|null); - } - - /** Represents an AsyncAnnotateFileResponse. */ - class AsyncAnnotateFileResponse implements IAsyncAnnotateFileResponse { - - /** - * Constructs a new AsyncAnnotateFileResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse); - - /** AsyncAnnotateFileResponse outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p2beta1.IOutputConfig|null); - - /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncAnnotateFileResponse instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse): google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse; - - /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.AsyncAnnotateFileResponse; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.AsyncAnnotateFileResponse; - - /** - * 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 an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncAnnotateFileResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse; - - /** - * 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.v1p2beta1.AsyncAnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncAnnotateFileResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncAnnotateFileResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateFilesRequest. */ - interface IAsyncBatchAnnotateFilesRequest { - - /** AsyncBatchAnnotateFilesRequest requests */ - requests?: (google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest[]|null); - } - - /** Represents an AsyncBatchAnnotateFilesRequest. */ - class AsyncBatchAnnotateFilesRequest implements IAsyncBatchAnnotateFilesRequest { - - /** - * Constructs a new AsyncBatchAnnotateFilesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest); - - /** AsyncBatchAnnotateFilesRequest requests. */ - public requests: google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest[]; - - /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest): google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.AsyncBatchAnnotateFilesRequest; - - /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.AsyncBatchAnnotateFilesRequest; - - /** - * 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 an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateFilesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest; - - /** - * 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.v1p2beta1.AsyncBatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateFilesResponse. */ - interface IAsyncBatchAnnotateFilesResponse { - - /** AsyncBatchAnnotateFilesResponse responses */ - responses?: (google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse[]|null); - } - - /** Represents an AsyncBatchAnnotateFilesResponse. */ - class AsyncBatchAnnotateFilesResponse implements IAsyncBatchAnnotateFilesResponse { - - /** - * Constructs a new AsyncBatchAnnotateFilesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse); - - /** AsyncBatchAnnotateFilesResponse responses. */ - public responses: google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse[]; - - /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse): google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.AsyncBatchAnnotateFilesResponse; - - /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.AsyncBatchAnnotateFilesResponse; - - /** - * 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 an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateFilesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse; - - /** - * 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.v1p2beta1.AsyncBatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InputConfig. */ - interface IInputConfig { - - /** InputConfig gcsSource */ - gcsSource?: (google.cloud.vision.v1p2beta1.IGcsSource|null); - - /** InputConfig mimeType */ - mimeType?: (string|null); - } - - /** Represents an InputConfig. */ - class InputConfig implements IInputConfig { - - /** - * Constructs a new InputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IInputConfig); - - /** InputConfig gcsSource. */ - public gcsSource?: (google.cloud.vision.v1p2beta1.IGcsSource|null); - - /** InputConfig mimeType. */ - public mimeType: string; - - /** - * Creates a new InputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns InputConfig instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IInputConfig): google.cloud.vision.v1p2beta1.InputConfig; - - /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.InputConfig; - - /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.InputConfig; - - /** - * 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 an InputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.InputConfig; - - /** - * 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.v1p2beta1.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OutputConfig. */ - interface IOutputConfig { - - /** OutputConfig gcsDestination */ - gcsDestination?: (google.cloud.vision.v1p2beta1.IGcsDestination|null); - - /** OutputConfig batchSize */ - batchSize?: (number|null); - } - - /** Represents an OutputConfig. */ - class OutputConfig implements IOutputConfig { - - /** - * Constructs a new OutputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IOutputConfig); - - /** OutputConfig gcsDestination. */ - public gcsDestination?: (google.cloud.vision.v1p2beta1.IGcsDestination|null); - - /** OutputConfig batchSize. */ - public batchSize: number; - - /** - * Creates a new OutputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns OutputConfig instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IOutputConfig): google.cloud.vision.v1p2beta1.OutputConfig; - - /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.OutputConfig; - - /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.OutputConfig; - - /** - * 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 an OutputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OutputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.OutputConfig; - - /** - * 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.v1p2beta1.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OutputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OutputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GcsSource. */ - interface IGcsSource { - - /** GcsSource uri */ - uri?: (string|null); - } - - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { - - /** - * Constructs a new GcsSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IGcsSource); - - /** GcsSource uri. */ - public uri: string; - - /** - * Creates a new GcsSource instance using the specified properties. - * @param [properties] Properties to set - * @returns GcsSource instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IGcsSource): google.cloud.vision.v1p2beta1.GcsSource; - - /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.GcsSource; - - /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.GcsSource; - - /** - * 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 GcsSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GcsSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.GcsSource; - - /** - * 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.v1p2beta1.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GcsSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GcsSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GcsDestination. */ - interface IGcsDestination { - - /** GcsDestination uri */ - uri?: (string|null); - } - - /** Represents a GcsDestination. */ - class GcsDestination implements IGcsDestination { - - /** - * Constructs a new GcsDestination. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IGcsDestination); - - /** GcsDestination uri. */ - public uri: string; - - /** - * Creates a new GcsDestination instance using the specified properties. - * @param [properties] Properties to set - * @returns GcsDestination instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IGcsDestination): google.cloud.vision.v1p2beta1.GcsDestination; - - /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.GcsDestination; - - /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.GcsDestination; - - /** - * 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 GcsDestination message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GcsDestination - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.GcsDestination; - - /** - * 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.v1p2beta1.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GcsDestination to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GcsDestination - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OperationMetadata. */ - interface IOperationMetadata { - - /** OperationMetadata state */ - state?: (google.cloud.vision.v1p2beta1.OperationMetadata.State|keyof typeof google.cloud.vision.v1p2beta1.OperationMetadata.State|null); - - /** OperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents an OperationMetadata. */ - class OperationMetadata implements IOperationMetadata { - - /** - * Constructs a new OperationMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IOperationMetadata); - - /** OperationMetadata state. */ - public state: (google.cloud.vision.v1p2beta1.OperationMetadata.State|keyof typeof google.cloud.vision.v1p2beta1.OperationMetadata.State); - - /** OperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationMetadata instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IOperationMetadata): google.cloud.vision.v1p2beta1.OperationMetadata; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.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.v1p2beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p2beta1.OperationMetadata; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p2beta1.OperationMetadata; - - /** - * 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 an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.OperationMetadata; - - /** - * 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.v1p2beta1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace OperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - CREATED = 1, - RUNNING = 2, - DONE = 3, - CANCELLED = 4 - } - } - - /** Likelihood enum. */ - enum Likelihood { - UNKNOWN = 0, - VERY_UNLIKELY = 1, - UNLIKELY = 2, - POSSIBLE = 3, - LIKELY = 4, - VERY_LIKELY = 5 - } - - /** Properties of a TextAnnotation. */ - interface ITextAnnotation { - - /** TextAnnotation pages */ - pages?: (google.cloud.vision.v1p2beta1.IPage[]|null); - - /** TextAnnotation text */ - text?: (string|null); - } - - /** Represents a TextAnnotation. */ - class TextAnnotation implements ITextAnnotation { - - /** - * Constructs a new TextAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ITextAnnotation); - - /** TextAnnotation pages. */ - public pages: google.cloud.vision.v1p2beta1.IPage[]; - - /** TextAnnotation text. */ - public text: string; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns TextAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ITextAnnotation): google.cloud.vision.v1p2beta1.TextAnnotation; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Verifies a TextAnnotation 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 TextAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.TextAnnotation; - - /** - * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. - * @param message TextAnnotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.TextAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace TextAnnotation { - - /** Properties of a DetectedLanguage. */ - interface IDetectedLanguage { - - /** DetectedLanguage languageCode */ - languageCode?: (string|null); - - /** DetectedLanguage confidence */ - confidence?: (number|null); - } - - /** Represents a DetectedLanguage. */ - class DetectedLanguage implements IDetectedLanguage { - - /** - * Constructs a new DetectedLanguage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage); - - /** DetectedLanguage languageCode. */ - public languageCode: string; - - /** DetectedLanguage confidence. */ - public confidence: number; - - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedLanguage instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage): google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage; - - /** - * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Verifies a DetectedLanguage 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 DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedLanguage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @param message DetectedLanguage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedLanguage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedLanguage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DetectedBreak. */ - interface IDetectedBreak { - - /** DetectedBreak type */ - type?: (google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType|null); - - /** DetectedBreak isPrefix */ - isPrefix?: (boolean|null); - } - - /** Represents a DetectedBreak. */ - class DetectedBreak implements IDetectedBreak { - - /** - * Constructs a new DetectedBreak. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak); - - /** DetectedBreak type. */ - public type: (google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType); - - /** DetectedBreak isPrefix. */ - public isPrefix: boolean; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedBreak instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak): google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Verifies a DetectedBreak 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 DetectedBreak message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedBreak - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak; - - /** - * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. - * @param message DetectedBreak - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedBreak to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedBreak - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DetectedBreak { - - /** BreakType enum. */ - enum BreakType { - UNKNOWN = 0, - SPACE = 1, - SURE_SPACE = 2, - EOL_SURE_SPACE = 3, - HYPHEN = 4, - LINE_BREAK = 5 - } - } - - /** Properties of a TextProperty. */ - interface ITextProperty { - - /** TextProperty detectedLanguages */ - detectedLanguages?: (google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage[]|null); - - /** TextProperty detectedBreak */ - detectedBreak?: (google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak|null); - } - - /** Represents a TextProperty. */ - class TextProperty implements ITextProperty { - - /** - * Constructs a new TextProperty. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty); - - /** TextProperty detectedLanguages. */ - public detectedLanguages: google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage[]; - - /** TextProperty detectedBreak. */ - public detectedBreak?: (google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak|null); - - /** - * Creates a new TextProperty instance using the specified properties. - * @param [properties] Properties to set - * @returns TextProperty instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty): google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty; - - /** - * Encodes the specified TextProperty message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextProperty message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextProperty message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Decodes a TextProperty message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Verifies a TextProperty 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 TextProperty message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextProperty - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty; - - /** - * Creates a plain object from a TextProperty message. Also converts values to other types if specified. - * @param message TextProperty - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextProperty to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextProperty - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a Page. */ - interface IPage { - - /** Page property */ - property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Page width */ - width?: (number|null); - - /** Page height */ - height?: (number|null); - - /** Page blocks */ - blocks?: (google.cloud.vision.v1p2beta1.IBlock[]|null); - - /** Page confidence */ - confidence?: (number|null); - } - - /** Represents a Page. */ - class Page implements IPage { - - /** - * Constructs a new Page. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IPage); - - /** Page property. */ - public property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Page width. */ - public width: number; - - /** Page height. */ - public height: number; - - /** Page blocks. */ - public blocks: google.cloud.vision.v1p2beta1.IBlock[]; - - /** Page confidence. */ - public confidence: number; - - /** - * Creates a new Page instance using the specified properties. - * @param [properties] Properties to set - * @returns Page instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IPage): google.cloud.vision.v1p2beta1.Page; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Page message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Page - * @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.Page; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Page - * @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.Page; - - /** - * Verifies a Page 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 Page message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Page - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Page; - - /** - * Creates a plain object from a Page message. Also converts values to other types if specified. - * @param message Page - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Page to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Page - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Block. */ - interface IBlock { - - /** Block property */ - property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox */ - boundingBox?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** Block paragraphs */ - paragraphs?: (google.cloud.vision.v1p2beta1.IParagraph[]|null); - - /** Block blockType */ - blockType?: (google.cloud.vision.v1p2beta1.Block.BlockType|keyof typeof google.cloud.vision.v1p2beta1.Block.BlockType|null); - - /** Block confidence */ - confidence?: (number|null); - } - - /** Represents a Block. */ - class Block implements IBlock { - - /** - * Constructs a new Block. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IBlock); - - /** Block property. */ - public property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** Block paragraphs. */ - public paragraphs: google.cloud.vision.v1p2beta1.IParagraph[]; - - /** Block blockType. */ - public blockType: (google.cloud.vision.v1p2beta1.Block.BlockType|keyof typeof google.cloud.vision.v1p2beta1.Block.BlockType); - - /** Block confidence. */ - public confidence: number; - - /** - * Creates a new Block instance using the specified properties. - * @param [properties] Properties to set - * @returns Block instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IBlock): google.cloud.vision.v1p2beta1.Block; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Block message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Block - * @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.Block; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Block - * @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.Block; - - /** - * Verifies a Block 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 Block message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Block - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Block; - - /** - * Creates a plain object from a Block message. Also converts values to other types if specified. - * @param message Block - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Block to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Block - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Block { - - /** BlockType enum. */ - enum BlockType { - UNKNOWN = 0, - TEXT = 1, - TABLE = 2, - PICTURE = 3, - RULER = 4, - BARCODE = 5 - } - } - - /** Properties of a Paragraph. */ - interface IParagraph { - - /** Paragraph property */ - property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox */ - boundingBox?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** Paragraph words */ - words?: (google.cloud.vision.v1p2beta1.IWord[]|null); - - /** Paragraph confidence */ - confidence?: (number|null); - } - - /** Represents a Paragraph. */ - class Paragraph implements IParagraph { - - /** - * Constructs a new Paragraph. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IParagraph); - - /** Paragraph property. */ - public property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** Paragraph words. */ - public words: google.cloud.vision.v1p2beta1.IWord[]; - - /** Paragraph confidence. */ - public confidence: number; - - /** - * Creates a new Paragraph instance using the specified properties. - * @param [properties] Properties to set - * @returns Paragraph instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IParagraph): google.cloud.vision.v1p2beta1.Paragraph; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Paragraph message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Paragraph - * @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.Paragraph; - - /** - * Decodes a Paragraph message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Paragraph - * @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.Paragraph; - - /** - * Verifies a Paragraph 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 Paragraph message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Paragraph - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Paragraph; - - /** - * Creates a plain object from a Paragraph message. Also converts values to other types if specified. - * @param message Paragraph - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Paragraph to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Paragraph - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Word. */ - interface IWord { - - /** Word property */ - property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox */ - boundingBox?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** Word symbols */ - symbols?: (google.cloud.vision.v1p2beta1.ISymbol[]|null); - - /** Word confidence */ - confidence?: (number|null); - } - - /** Represents a Word. */ - class Word implements IWord { - - /** - * Constructs a new Word. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IWord); - - /** Word property. */ - public property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** Word symbols. */ - public symbols: google.cloud.vision.v1p2beta1.ISymbol[]; - - /** Word confidence. */ - public confidence: number; - - /** - * Creates a new Word instance using the specified properties. - * @param [properties] Properties to set - * @returns Word instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IWord): google.cloud.vision.v1p2beta1.Word; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Word message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Word message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Word - * @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.Word; - - /** - * Decodes a Word message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Word - * @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.Word; - - /** - * Verifies a Word 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 Word message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Word - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Word; - - /** - * Creates a plain object from a Word message. Also converts values to other types if specified. - * @param message Word - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.Word, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Word to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Word - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Symbol. */ - interface ISymbol { - - /** Symbol property */ - property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox */ - boundingBox?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** Symbol text */ - text?: (string|null); - - /** Symbol confidence */ - confidence?: (number|null); - } - - /** Represents a Symbol. */ - class Symbol implements ISymbol { - - /** - * Constructs a new Symbol. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.ISymbol); - - /** Symbol property. */ - public property?: (google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p2beta1.IBoundingPoly|null); - - /** Symbol text. */ - public text: string; - - /** Symbol confidence. */ - public confidence: number; - - /** - * Creates a new Symbol instance using the specified properties. - * @param [properties] Properties to set - * @returns Symbol instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.ISymbol): google.cloud.vision.v1p2beta1.Symbol; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Symbol message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p2beta1.Symbol; - - /** - * Decodes a Symbol message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p2beta1.Symbol; - - /** - * Verifies a Symbol message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Symbol message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Symbol - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Symbol; - - /** - * Creates a plain object from a Symbol message. Also converts values to other types if specified. - * @param message Symbol - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Symbol to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Symbol - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetection. */ - interface IWebDetection { - - /** WebDetection webEntities */ - webEntities?: (google.cloud.vision.v1p2beta1.WebDetection.IWebEntity[]|null); - - /** WebDetection fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]|null); - - /** WebDetection partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]|null); - - /** WebDetection pagesWithMatchingImages */ - pagesWithMatchingImages?: (google.cloud.vision.v1p2beta1.WebDetection.IWebPage[]|null); - - /** WebDetection visuallySimilarImages */ - visuallySimilarImages?: (google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]|null); - - /** WebDetection bestGuessLabels */ - bestGuessLabels?: (google.cloud.vision.v1p2beta1.WebDetection.IWebLabel[]|null); - } - - /** Represents a WebDetection. */ - class WebDetection implements IWebDetection { - - /** - * Constructs a new WebDetection. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IWebDetection); - - /** WebDetection webEntities. */ - public webEntities: google.cloud.vision.v1p2beta1.WebDetection.IWebEntity[]; - - /** WebDetection fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]; - - /** WebDetection partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]; - - /** WebDetection pagesWithMatchingImages. */ - public pagesWithMatchingImages: google.cloud.vision.v1p2beta1.WebDetection.IWebPage[]; - - /** WebDetection visuallySimilarImages. */ - public visuallySimilarImages: google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]; - - /** WebDetection bestGuessLabels. */ - public bestGuessLabels: google.cloud.vision.v1p2beta1.WebDetection.IWebLabel[]; - - /** - * Creates a new WebDetection instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetection instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IWebDetection): google.cloud.vision.v1p2beta1.WebDetection; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetection message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebDetection message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebDetection - * @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.WebDetection; - - /** - * Decodes a WebDetection message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebDetection - * @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.WebDetection; - - /** - * Verifies a WebDetection 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 WebDetection message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetection - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.WebDetection; - - /** - * Creates a plain object from a WebDetection message. Also converts values to other types if specified. - * @param message WebDetection - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.WebDetection, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetection to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetection - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace WebDetection { - - /** Properties of a WebEntity. */ - interface IWebEntity { - - /** WebEntity entityId */ - entityId?: (string|null); - - /** WebEntity score */ - score?: (number|null); - - /** WebEntity description */ - description?: (string|null); - } - - /** Represents a WebEntity. */ - class WebEntity implements IWebEntity { - - /** - * Constructs a new WebEntity. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.WebDetection.IWebEntity); - - /** WebEntity entityId. */ - public entityId: string; - - /** WebEntity score. */ - public score: number; - - /** WebEntity description. */ - public description: string; - - /** - * Creates a new WebEntity instance using the specified properties. - * @param [properties] Properties to set - * @returns WebEntity instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.WebDetection.IWebEntity): google.cloud.vision.v1p2beta1.WebDetection.WebEntity; - - /** - * Encodes the specified WebEntity message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Verifies a WebEntity 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 WebEntity message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebEntity - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.WebDetection.WebEntity; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @param message WebEntity - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.WebDetection.WebEntity, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebEntity to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebEntity - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebImage. */ - interface IWebImage { - - /** WebImage url */ - url?: (string|null); - - /** WebImage score */ - score?: (number|null); - } - - /** Represents a WebImage. */ - class WebImage implements IWebImage { - - /** - * Constructs a new WebImage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.WebDetection.IWebImage); - - /** WebImage url. */ - public url: string; - - /** WebImage score. */ - public score: number; - - /** - * Creates a new WebImage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebImage instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.WebDetection.IWebImage): google.cloud.vision.v1p2beta1.WebDetection.WebImage; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Verifies a WebImage 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 WebImage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebImage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.WebDetection.WebImage; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @param message WebImage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.WebDetection.WebImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebImage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebImage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebPage. */ - interface IWebPage { - - /** WebPage url */ - url?: (string|null); - - /** WebPage score */ - score?: (number|null); - - /** WebPage pageTitle */ - pageTitle?: (string|null); - - /** WebPage fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]|null); - - /** WebPage partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]|null); - } - - /** Represents a WebPage. */ - class WebPage implements IWebPage { - - /** - * Constructs a new WebPage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.WebDetection.IWebPage); - - /** WebPage url. */ - public url: string; - - /** WebPage score. */ - public score: number; - - /** WebPage pageTitle. */ - public pageTitle: string; - - /** WebPage fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]; - - /** WebPage partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1p2beta1.WebDetection.IWebImage[]; - - /** - * Creates a new WebPage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebPage instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.WebDetection.IWebPage): google.cloud.vision.v1p2beta1.WebDetection.WebPage; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Verifies a WebPage 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 WebPage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebPage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.WebDetection.WebPage; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @param message WebPage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.WebDetection.WebPage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebPage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebPage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebLabel. */ - interface IWebLabel { - - /** WebLabel label */ - label?: (string|null); - - /** WebLabel languageCode */ - languageCode?: (string|null); - } - - /** Represents a WebLabel. */ - class WebLabel implements IWebLabel { - - /** - * Constructs a new WebLabel. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.WebDetection.IWebLabel); - - /** WebLabel label. */ - public label: string; - - /** WebLabel languageCode. */ - public languageCode: string; - - /** - * Creates a new WebLabel instance using the specified properties. - * @param [properties] Properties to set - * @returns WebLabel instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.WebDetection.IWebLabel): google.cloud.vision.v1p2beta1.WebDetection.WebLabel; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Verifies a WebLabel 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 WebLabel message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebLabel - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.WebDetection.WebLabel; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @param message WebLabel - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.WebDetection.WebLabel, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebLabel to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebLabel - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - - /** 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 }; - - /** - * Gets the default type url for Vertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for NormalizedVertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for BoundingPoly - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 }; - - /** - * Gets the default type url for Position - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** - * 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; - - /** - * 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.v1p3beta1.IBatchAnnotateImagesRequest, callback: google.cloud.vision.v1p3beta1.ImageAnnotator.BatchAnnotateImagesCallback): void; - - /** - * Calls BatchAnnotateImages. - * @param request BatchAnnotateImagesRequest message or plain object - * @returns Promise - */ - public batchAnnotateImages(request: google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest): Promise; - - /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest, callback: google.cloud.vision.v1p3beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback): void; - - /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @returns Promise - */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest): Promise; - } - - namespace ImageAnnotator { - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ImageAnnotator|batchAnnotateImages}. - * @param error Error, if any - * @param [response] BatchAnnotateImagesResponse - */ - type BatchAnnotateImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ImageAnnotator|asyncBatchAnnotateFiles}. - * @param error Error, if any - * @param [response] Operation - */ - type AsyncBatchAnnotateFilesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a Feature. */ - interface IFeature { - - /** Feature type */ - type?: (google.cloud.vision.v1p3beta1.Feature.Type|keyof typeof google.cloud.vision.v1p3beta1.Feature.Type|null); - - /** Feature maxResults */ - maxResults?: (number|null); - - /** Feature model */ - model?: (string|null); - } - - /** Represents a Feature. */ - class Feature implements IFeature { - - /** - * Constructs a new Feature. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IFeature); - - /** Feature type. */ - public type: (google.cloud.vision.v1p3beta1.Feature.Type|keyof typeof google.cloud.vision.v1p3beta1.Feature.Type); - - /** Feature maxResults. */ - public maxResults: number; - - /** Feature model. */ - public model: string; - - /** - * Creates a new Feature instance using the specified properties. - * @param [properties] Properties to set - * @returns Feature instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IFeature): google.cloud.vision.v1p3beta1.Feature; - - /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.Feature; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.Feature; - - /** - * 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 Feature message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Feature - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Feature; - - /** - * 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.v1p3beta1.Feature, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Feature to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Feature - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 { - - /** ImageSource gcsImageUri */ - gcsImageUri?: (string|null); - - /** ImageSource imageUri */ - imageUri?: (string|null); - } - - /** Represents an ImageSource. */ - class ImageSource implements IImageSource { - - /** - * Constructs a new ImageSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImageSource); - - /** ImageSource gcsImageUri. */ - public gcsImageUri: string; - - /** ImageSource imageUri. */ - public imageUri: string; - - /** - * Creates a new ImageSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageSource instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImageSource): google.cloud.vision.v1p3beta1.ImageSource; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.ImageSource; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.ImageSource; - - /** - * 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 an ImageSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ImageSource; - - /** - * 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.v1p3beta1.ImageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Image. */ - interface IImage { - - /** Image content */ - content?: (Uint8Array|string|null); - - /** Image source */ - source?: (google.cloud.vision.v1p3beta1.IImageSource|null); - } - - /** Represents an Image. */ - class Image implements IImage { - - /** - * Constructs a new Image. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImage); - - /** Image content. */ - public content: (Uint8Array|string); - - /** Image source. */ - public source?: (google.cloud.vision.v1p3beta1.IImageSource|null); - - /** - * Creates a new Image instance using the specified properties. - * @param [properties] Properties to set - * @returns Image instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImage): google.cloud.vision.v1p3beta1.Image; - - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.Image; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.Image; - - /** - * 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 an Image message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Image - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Image; - - /** - * 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.v1p3beta1.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Image to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Image - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FaceAnnotation. */ - interface IFaceAnnotation { - - /** FaceAnnotation boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly */ - fdBoundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** FaceAnnotation landmarks */ - landmarks?: (google.cloud.vision.v1p3beta1.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.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** FaceAnnotation sorrowLikelihood */ - sorrowLikelihood?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** FaceAnnotation angerLikelihood */ - angerLikelihood?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** FaceAnnotation surpriseLikelihood */ - surpriseLikelihood?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** FaceAnnotation underExposedLikelihood */ - underExposedLikelihood?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** FaceAnnotation blurredLikelihood */ - blurredLikelihood?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** FaceAnnotation headwearLikelihood */ - headwearLikelihood?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - } - - /** Represents a FaceAnnotation. */ - class FaceAnnotation implements IFaceAnnotation { - - /** - * Constructs a new FaceAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IFaceAnnotation); - - /** FaceAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly. */ - public fdBoundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** FaceAnnotation landmarks. */ - public landmarks: google.cloud.vision.v1p3beta1.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.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** FaceAnnotation sorrowLikelihood. */ - public sorrowLikelihood: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** FaceAnnotation angerLikelihood. */ - public angerLikelihood: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** FaceAnnotation surpriseLikelihood. */ - public surpriseLikelihood: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** FaceAnnotation underExposedLikelihood. */ - public underExposedLikelihood: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** FaceAnnotation blurredLikelihood. */ - public blurredLikelihood: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** FaceAnnotation headwearLikelihood. */ - public headwearLikelihood: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** - * Creates a new FaceAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns FaceAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IFaceAnnotation): google.cloud.vision.v1p3beta1.FaceAnnotation; - - /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.FaceAnnotation; - - /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.FaceAnnotation; - - /** - * 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 FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FaceAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.FaceAnnotation; - - /** - * 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.v1p3beta1.FaceAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FaceAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FaceAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FaceAnnotation { - - /** Properties of a Landmark. */ - interface ILandmark { - - /** Landmark type */ - type?: (google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type|null); - - /** Landmark position */ - position?: (google.cloud.vision.v1p3beta1.IPosition|null); - } - - /** Represents a Landmark. */ - class Landmark implements ILandmark { - - /** - * Constructs a new Landmark. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark); - - /** Landmark type. */ - public type: (google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type); - - /** Landmark position. */ - public position?: (google.cloud.vision.v1p3beta1.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.v1p3beta1.FaceAnnotation.ILandmark): google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark; - - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.FaceAnnotation.ILandmark, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.FaceAnnotation.Landmark, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Landmark to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Landmark - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 LocationInfo. */ - interface ILocationInfo { - - /** LocationInfo latLng */ - latLng?: (google.type.ILatLng|null); - } - - /** Represents a LocationInfo. */ - class LocationInfo implements ILocationInfo { - - /** - * Constructs a new LocationInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ILocationInfo); - - /** LocationInfo latLng. */ - public latLng?: (google.type.ILatLng|null); - - /** - * Creates a new LocationInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns LocationInfo instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ILocationInfo): google.cloud.vision.v1p3beta1.LocationInfo; - - /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LocationInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p3beta1.LocationInfo; - - /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p3beta1.LocationInfo; - - /** - * Verifies a LocationInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocationInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.LocationInfo; - - /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @param message LocationInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocationInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocationInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Property. */ - interface IProperty { - - /** Property name */ - name?: (string|null); - - /** Property value */ - value?: (string|null); - - /** Property uint64Value */ - uint64Value?: (number|Long|string|null); - } - - /** Represents a Property. */ - class Property implements IProperty { - - /** - * Constructs a new Property. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IProperty); - - /** Property name. */ - public name: string; - - /** Property value. */ - public value: string; - - /** Property uint64Value. */ - public uint64Value: (number|Long|string); - - /** - * Creates a new Property instance using the specified properties. - * @param [properties] Properties to set - * @returns Property instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IProperty): google.cloud.vision.v1p3beta1.Property; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Property message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p3beta1.Property; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p3beta1.Property; - - /** - * Verifies a Property message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Property - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Property; - - /** - * 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.v1p3beta1.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Property to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Property - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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.v1p3beta1.IBoundingPoly|null); - - /** EntityAnnotation locations */ - locations?: (google.cloud.vision.v1p3beta1.ILocationInfo[]|null); - - /** EntityAnnotation properties */ - properties?: (google.cloud.vision.v1p3beta1.IProperty[]|null); - } - - /** Represents an EntityAnnotation. */ - class EntityAnnotation implements IEntityAnnotation { - - /** - * Constructs a new EntityAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.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; - - /** EntityAnnotation topicality. */ - public topicality: number; - - /** EntityAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** EntityAnnotation locations. */ - public locations: google.cloud.vision.v1p3beta1.ILocationInfo[]; - - /** EntityAnnotation properties. */ - public properties: google.cloud.vision.v1p3beta1.IProperty[]; - - /** - * Creates a new EntityAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns EntityAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IEntityAnnotation): google.cloud.vision.v1p3beta1.EntityAnnotation; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p3beta1.EntityAnnotation; - - /** - * 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 - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p3beta1.EntityAnnotation; - - /** - * 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 an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EntityAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.EntityAnnotation; - - /** - * 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.v1p3beta1.EntityAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EntityAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EntityAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LocalizedObjectAnnotation. */ - interface ILocalizedObjectAnnotation { - - /** 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.v1p3beta1.IBoundingPoly|null); - } - - /** Represents a LocalizedObjectAnnotation. */ - class LocalizedObjectAnnotation implements ILocalizedObjectAnnotation { - - /** - * Constructs a new LocalizedObjectAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation); - - /** 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.v1p3beta1.IBoundingPoly|null); - - /** - * Creates a new LocalizedObjectAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns LocalizedObjectAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation): google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation; - - /** - * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.LocalizedObjectAnnotation; - - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.LocalizedObjectAnnotation; - - /** - * 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 LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocalizedObjectAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation; - - /** - * 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.v1p3beta1.LocalizedObjectAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocalizedObjectAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocalizedObjectAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SafeSearchAnnotation. */ - interface ISafeSearchAnnotation { - - /** SafeSearchAnnotation adult */ - adult?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** SafeSearchAnnotation spoof */ - spoof?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** SafeSearchAnnotation medical */ - medical?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** SafeSearchAnnotation violence */ - violence?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - - /** SafeSearchAnnotation racy */ - racy?: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood|null); - } - - /** Represents a SafeSearchAnnotation. */ - class SafeSearchAnnotation implements ISafeSearchAnnotation { - - /** - * Constructs a new SafeSearchAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ISafeSearchAnnotation); - - /** SafeSearchAnnotation adult. */ - public adult: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** SafeSearchAnnotation spoof. */ - public spoof: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** SafeSearchAnnotation medical. */ - public medical: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** SafeSearchAnnotation violence. */ - public violence: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** SafeSearchAnnotation racy. */ - public racy: (google.cloud.vision.v1p3beta1.Likelihood|keyof typeof google.cloud.vision.v1p3beta1.Likelihood); - - /** - * Creates a new SafeSearchAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns SafeSearchAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ISafeSearchAnnotation): google.cloud.vision.v1p3beta1.SafeSearchAnnotation; - - /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.SafeSearchAnnotation; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.SafeSearchAnnotation; - - /** - * 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 SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SafeSearchAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.SafeSearchAnnotation; - - /** - * 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.v1p3beta1.SafeSearchAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LatLongRect. */ - interface ILatLongRect { - - /** LatLongRect minLatLng */ - minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng */ - maxLatLng?: (google.type.ILatLng|null); - } - - /** Represents a LatLongRect. */ - class LatLongRect implements ILatLongRect { - - /** - * Constructs a new LatLongRect. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ILatLongRect); - - /** LatLongRect minLatLng. */ - public minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng. */ - public maxLatLng?: (google.type.ILatLng|null); - - /** - * Creates a new LatLongRect instance using the specified properties. - * @param [properties] Properties to set - * @returns LatLongRect instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ILatLongRect): google.cloud.vision.v1p3beta1.LatLongRect; - - /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.LatLongRect; - - /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.LatLongRect; - - /** - * 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 LatLongRect message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LatLongRect - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.LatLongRect; - - /** - * 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.v1p3beta1.LatLongRect, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LatLongRect to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LatLongRect - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ColorInfo. */ - interface IColorInfo { - - /** ColorInfo color */ - color?: (google.type.IColor|null); - - /** ColorInfo score */ - score?: (number|null); - - /** ColorInfo pixelFraction */ - pixelFraction?: (number|null); - } - - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { - - /** - * Constructs a new ColorInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IColorInfo); - - /** ColorInfo color. */ - public color?: (google.type.IColor|null); - - /** ColorInfo score. */ - public score: number; - - /** ColorInfo pixelFraction. */ - public pixelFraction: number; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns ColorInfo instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IColorInfo): google.cloud.vision.v1p3beta1.ColorInfo; - - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.ColorInfo; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.ColorInfo; - - /** - * 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 a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ColorInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ColorInfo; - - /** - * 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.v1p3beta1.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ColorInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ColorInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DominantColorsAnnotation. */ - interface IDominantColorsAnnotation { - - /** DominantColorsAnnotation colors */ - colors?: (google.cloud.vision.v1p3beta1.IColorInfo[]|null); - } - - /** Represents a DominantColorsAnnotation. */ - class DominantColorsAnnotation implements IDominantColorsAnnotation { - - /** - * Constructs a new DominantColorsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IDominantColorsAnnotation); - - /** DominantColorsAnnotation colors. */ - public colors: google.cloud.vision.v1p3beta1.IColorInfo[]; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns DominantColorsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IDominantColorsAnnotation): google.cloud.vision.v1p3beta1.DominantColorsAnnotation; - - /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.DominantColorsAnnotation; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.DominantColorsAnnotation; - - /** - * 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 a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DominantColorsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.DominantColorsAnnotation; - - /** - * 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.v1p3beta1.DominantColorsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageProperties. */ - interface IImageProperties { - - /** ImageProperties dominantColors */ - dominantColors?: (google.cloud.vision.v1p3beta1.IDominantColorsAnnotation|null); - } - - /** Represents an ImageProperties. */ - class ImageProperties implements IImageProperties { - - /** - * Constructs a new ImageProperties. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImageProperties); - - /** ImageProperties dominantColors. */ - public dominantColors?: (google.cloud.vision.v1p3beta1.IDominantColorsAnnotation|null); - - /** - * Creates a new ImageProperties instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageProperties instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImageProperties): google.cloud.vision.v1p3beta1.ImageProperties; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 ImageProperties - * @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.ImageProperties; - - /** - * 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.v1p3beta1.ImageProperties; - - /** - * Verifies an ImageProperties 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. - * @param object Plain object - * @returns ImageProperties - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ImageProperties; - - /** - * 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.v1p3beta1.ImageProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageProperties to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageProperties - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHint. */ - interface ICropHint { - - /** CropHint boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** CropHint confidence */ - confidence?: (number|null); - - /** CropHint importanceFraction */ - importanceFraction?: (number|null); - } - - /** Represents a CropHint. */ - class CropHint implements ICropHint { - - /** - * Constructs a new CropHint. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ICropHint); - - /** CropHint boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** CropHint confidence. */ - public confidence: number; - - /** CropHint importanceFraction. */ - public importanceFraction: number; - - /** - * Creates a new CropHint instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHint instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ICropHint): google.cloud.vision.v1p3beta1.CropHint; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.CropHint; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.CropHint; - - /** - * 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 a CropHint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHint - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.CropHint; - - /** - * 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.v1p3beta1.CropHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsAnnotation. */ - interface ICropHintsAnnotation { - - /** CropHintsAnnotation cropHints */ - cropHints?: (google.cloud.vision.v1p3beta1.ICropHint[]|null); - } - - /** Represents a CropHintsAnnotation. */ - class CropHintsAnnotation implements ICropHintsAnnotation { - - /** - * Constructs a new CropHintsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ICropHintsAnnotation); - - /** CropHintsAnnotation cropHints. */ - public cropHints: google.cloud.vision.v1p3beta1.ICropHint[]; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ICropHintsAnnotation): google.cloud.vision.v1p3beta1.CropHintsAnnotation; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.CropHintsAnnotation; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.CropHintsAnnotation; - - /** - * 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 CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.CropHintsAnnotation; - - /** - * 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.v1p3beta1.CropHintsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsParams. */ - interface ICropHintsParams { - - /** CropHintsParams aspectRatios */ - aspectRatios?: (number[]|null); - } - - /** Represents a CropHintsParams. */ - class CropHintsParams implements ICropHintsParams { - - /** - * Constructs a new CropHintsParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ICropHintsParams); - - /** CropHintsParams aspectRatios. */ - public aspectRatios: number[]; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsParams instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ICropHintsParams): google.cloud.vision.v1p3beta1.CropHintsParams; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.CropHintsParams; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.CropHintsParams; - - /** - * 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 CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.CropHintsParams; - - /** - * 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.v1p3beta1.CropHintsParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetectionParams. */ - interface IWebDetectionParams { - - /** WebDetectionParams includeGeoResults */ - includeGeoResults?: (boolean|null); - } - - /** Represents a WebDetectionParams. */ - class WebDetectionParams implements IWebDetectionParams { - - /** - * Constructs a new WebDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IWebDetectionParams); - - /** WebDetectionParams includeGeoResults. */ - public includeGeoResults: boolean; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IWebDetectionParams): google.cloud.vision.v1p3beta1.WebDetectionParams; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.WebDetectionParams; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.WebDetectionParams; - - /** - * 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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.WebDetectionParams; - - /** - * 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.v1p3beta1.WebDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TextDetectionParams. */ - interface ITextDetectionParams { - - /** TextDetectionParams enableTextDetectionConfidenceScore */ - enableTextDetectionConfidenceScore?: (boolean|null); - - /** TextDetectionParams advancedOcrOptions */ - advancedOcrOptions?: (string[]|null); - } - - /** Represents a TextDetectionParams. */ - class TextDetectionParams implements ITextDetectionParams { - - /** - * Constructs a new TextDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ITextDetectionParams); - - /** TextDetectionParams enableTextDetectionConfidenceScore. */ - public enableTextDetectionConfidenceScore: boolean; - - /** TextDetectionParams advancedOcrOptions. */ - public advancedOcrOptions: string[]; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns TextDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ITextDetectionParams): google.cloud.vision.v1p3beta1.TextDetectionParams; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Verifies a TextDetectionParams 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 TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.TextDetectionParams; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @param message TextDetectionParams - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.TextDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageContext. */ - interface IImageContext { - - /** ImageContext latLongRect */ - latLongRect?: (google.cloud.vision.v1p3beta1.ILatLongRect|null); - - /** ImageContext languageHints */ - languageHints?: (string[]|null); - - /** ImageContext cropHintsParams */ - cropHintsParams?: (google.cloud.vision.v1p3beta1.ICropHintsParams|null); - - /** ImageContext productSearchParams */ - productSearchParams?: (google.cloud.vision.v1p3beta1.IProductSearchParams|null); - - /** ImageContext webDetectionParams */ - webDetectionParams?: (google.cloud.vision.v1p3beta1.IWebDetectionParams|null); - - /** ImageContext textDetectionParams */ - textDetectionParams?: (google.cloud.vision.v1p3beta1.ITextDetectionParams|null); - } - - /** Represents an ImageContext. */ - class ImageContext implements IImageContext { - - /** - * Constructs a new ImageContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImageContext); - - /** ImageContext latLongRect. */ - public latLongRect?: (google.cloud.vision.v1p3beta1.ILatLongRect|null); - - /** ImageContext languageHints. */ - public languageHints: string[]; - - /** ImageContext cropHintsParams. */ - public cropHintsParams?: (google.cloud.vision.v1p3beta1.ICropHintsParams|null); - - /** ImageContext productSearchParams. */ - public productSearchParams?: (google.cloud.vision.v1p3beta1.IProductSearchParams|null); - - /** ImageContext webDetectionParams. */ - public webDetectionParams?: (google.cloud.vision.v1p3beta1.IWebDetectionParams|null); - - /** ImageContext textDetectionParams. */ - public textDetectionParams?: (google.cloud.vision.v1p3beta1.ITextDetectionParams|null); - - /** - * Creates a new ImageContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageContext instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImageContext): google.cloud.vision.v1p3beta1.ImageContext; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.ImageContext; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.ImageContext; - - /** - * 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 ImageContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ImageContext; - - /** - * 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.v1p3beta1.ImageContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageRequest. */ - interface IAnnotateImageRequest { - - /** AnnotateImageRequest image */ - image?: (google.cloud.vision.v1p3beta1.IImage|null); - - /** AnnotateImageRequest features */ - features?: (google.cloud.vision.v1p3beta1.IFeature[]|null); - - /** AnnotateImageRequest imageContext */ - imageContext?: (google.cloud.vision.v1p3beta1.IImageContext|null); - } - - /** Represents an AnnotateImageRequest. */ - class AnnotateImageRequest implements IAnnotateImageRequest { - - /** - * Constructs a new AnnotateImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IAnnotateImageRequest); - - /** AnnotateImageRequest image. */ - public image?: (google.cloud.vision.v1p3beta1.IImage|null); - - /** AnnotateImageRequest features. */ - public features: google.cloud.vision.v1p3beta1.IFeature[]; - - /** AnnotateImageRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p3beta1.IImageContext|null); - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IAnnotateImageRequest): google.cloud.vision.v1p3beta1.AnnotateImageRequest; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.AnnotateImageRequest; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.AnnotateImageRequest; - - /** - * 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 an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.AnnotateImageRequest; - - /** - * 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.v1p3beta1.AnnotateImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageAnnotationContext. */ - interface IImageAnnotationContext { - - /** ImageAnnotationContext uri */ - uri?: (string|null); - - /** ImageAnnotationContext pageNumber */ - pageNumber?: (number|null); - } - - /** Represents an ImageAnnotationContext. */ - class ImageAnnotationContext implements IImageAnnotationContext { - - /** - * Constructs a new ImageAnnotationContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImageAnnotationContext); - - /** ImageAnnotationContext uri. */ - public uri: string; - - /** ImageAnnotationContext pageNumber. */ - public pageNumber: number; - - /** - * Creates a new ImageAnnotationContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageAnnotationContext instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImageAnnotationContext): google.cloud.vision.v1p3beta1.ImageAnnotationContext; - - /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.ImageAnnotationContext; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.ImageAnnotationContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageAnnotationContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageAnnotationContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageResponse. */ - interface IAnnotateImageResponse { - - /** AnnotateImageResponse faceAnnotations */ - faceAnnotations?: (google.cloud.vision.v1p3beta1.IFaceAnnotation[]|null); - - /** AnnotateImageResponse landmarkAnnotations */ - landmarkAnnotations?: (google.cloud.vision.v1p3beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse logoAnnotations */ - logoAnnotations?: (google.cloud.vision.v1p3beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse labelAnnotations */ - labelAnnotations?: (google.cloud.vision.v1p3beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse localizedObjectAnnotations */ - localizedObjectAnnotations?: (google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation[]|null); - - /** AnnotateImageResponse textAnnotations */ - textAnnotations?: (google.cloud.vision.v1p3beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse fullTextAnnotation */ - fullTextAnnotation?: (google.cloud.vision.v1p3beta1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation */ - safeSearchAnnotation?: (google.cloud.vision.v1p3beta1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation */ - imagePropertiesAnnotation?: (google.cloud.vision.v1p3beta1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation */ - cropHintsAnnotation?: (google.cloud.vision.v1p3beta1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection */ - webDetection?: (google.cloud.vision.v1p3beta1.IWebDetection|null); - - /** AnnotateImageResponse productSearchResults */ - productSearchResults?: (google.cloud.vision.v1p3beta1.IProductSearchResults|null); - - /** AnnotateImageResponse error */ - error?: (google.rpc.IStatus|null); - - /** AnnotateImageResponse context */ - context?: (google.cloud.vision.v1p3beta1.IImageAnnotationContext|null); - } - - /** Represents an AnnotateImageResponse. */ - class AnnotateImageResponse implements IAnnotateImageResponse { - - /** - * Constructs a new AnnotateImageResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IAnnotateImageResponse); - - /** AnnotateImageResponse faceAnnotations. */ - public faceAnnotations: google.cloud.vision.v1p3beta1.IFaceAnnotation[]; - - /** AnnotateImageResponse landmarkAnnotations. */ - public landmarkAnnotations: google.cloud.vision.v1p3beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse logoAnnotations. */ - public logoAnnotations: google.cloud.vision.v1p3beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse labelAnnotations. */ - public labelAnnotations: google.cloud.vision.v1p3beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse localizedObjectAnnotations. */ - public localizedObjectAnnotations: google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation[]; - - /** AnnotateImageResponse textAnnotations. */ - public textAnnotations: google.cloud.vision.v1p3beta1.IEntityAnnotation[]; - - /** AnnotateImageResponse fullTextAnnotation. */ - public fullTextAnnotation?: (google.cloud.vision.v1p3beta1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation. */ - public safeSearchAnnotation?: (google.cloud.vision.v1p3beta1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation. */ - public imagePropertiesAnnotation?: (google.cloud.vision.v1p3beta1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation. */ - public cropHintsAnnotation?: (google.cloud.vision.v1p3beta1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection. */ - public webDetection?: (google.cloud.vision.v1p3beta1.IWebDetection|null); - - /** AnnotateImageResponse productSearchResults. */ - public productSearchResults?: (google.cloud.vision.v1p3beta1.IProductSearchResults|null); - - /** AnnotateImageResponse error. */ - public error?: (google.rpc.IStatus|null); - - /** AnnotateImageResponse context. */ - public context?: (google.cloud.vision.v1p3beta1.IImageAnnotationContext|null); - - /** - * Creates a new AnnotateImageResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IAnnotateImageResponse): google.cloud.vision.v1p3beta1.AnnotateImageResponse; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.AnnotateImageResponse; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.AnnotateImageResponse; - - /** - * 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 AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.AnnotateImageResponse; - - /** - * 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.v1p3beta1.AnnotateImageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateFileResponse. */ - interface IAnnotateFileResponse { - - /** AnnotateFileResponse inputConfig */ - inputConfig?: (google.cloud.vision.v1p3beta1.IInputConfig|null); - - /** AnnotateFileResponse responses */ - responses?: (google.cloud.vision.v1p3beta1.IAnnotateImageResponse[]|null); - } - - /** Represents an AnnotateFileResponse. */ - class AnnotateFileResponse implements IAnnotateFileResponse { - - /** - * Constructs a new AnnotateFileResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IAnnotateFileResponse); - - /** AnnotateFileResponse inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p3beta1.IInputConfig|null); - - /** AnnotateFileResponse responses. */ - public responses: google.cloud.vision.v1p3beta1.IAnnotateImageResponse[]; - - /** - * Creates a new AnnotateFileResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateFileResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IAnnotateFileResponse): google.cloud.vision.v1p3beta1.AnnotateFileResponse; - - /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.AnnotateFileResponse; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.AnnotateFileResponse; - - /** - * 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 AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateFileResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.AnnotateFileResponse; - - /** - * 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.v1p3beta1.AnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateFileResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateFileResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesRequest. */ - interface IBatchAnnotateImagesRequest { - - /** BatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1p3beta1.IAnnotateImageRequest[]|null); - } - - /** Represents a BatchAnnotateImagesRequest. */ - class BatchAnnotateImagesRequest implements IBatchAnnotateImagesRequest { - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest); - - /** BatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1p3beta1.IAnnotateImageRequest[]; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest): google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.BatchAnnotateImagesRequest; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.BatchAnnotateImagesRequest; - - /** - * 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 a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest; - - /** - * 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.v1p3beta1.BatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesResponse. */ - interface IBatchAnnotateImagesResponse { - - /** BatchAnnotateImagesResponse responses */ - responses?: (google.cloud.vision.v1p3beta1.IAnnotateImageResponse[]|null); - } - - /** Represents a BatchAnnotateImagesResponse. */ - class BatchAnnotateImagesResponse implements IBatchAnnotateImagesResponse { - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse); - - /** BatchAnnotateImagesResponse responses. */ - public responses: google.cloud.vision.v1p3beta1.IAnnotateImageResponse[]; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse): google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse; - - /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.BatchAnnotateImagesResponse; - - /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.BatchAnnotateImagesResponse; - - /** - * 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 a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse; - - /** - * 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.v1p3beta1.BatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncAnnotateFileRequest. */ - interface IAsyncAnnotateFileRequest { - - /** AsyncAnnotateFileRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1p3beta1.IInputConfig|null); - - /** AsyncAnnotateFileRequest features */ - features?: (google.cloud.vision.v1p3beta1.IFeature[]|null); - - /** AsyncAnnotateFileRequest imageContext */ - imageContext?: (google.cloud.vision.v1p3beta1.IImageContext|null); - - /** AsyncAnnotateFileRequest outputConfig */ - outputConfig?: (google.cloud.vision.v1p3beta1.IOutputConfig|null); - } - - /** Represents an AsyncAnnotateFileRequest. */ - class AsyncAnnotateFileRequest implements IAsyncAnnotateFileRequest { - - /** - * Constructs a new AsyncAnnotateFileRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest); - - /** AsyncAnnotateFileRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p3beta1.IInputConfig|null); - - /** AsyncAnnotateFileRequest features. */ - public features: google.cloud.vision.v1p3beta1.IFeature[]; - - /** AsyncAnnotateFileRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p3beta1.IImageContext|null); - - /** AsyncAnnotateFileRequest outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p3beta1.IOutputConfig|null); - - /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncAnnotateFileRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest): google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest; - - /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.AsyncAnnotateFileRequest; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.AsyncAnnotateFileRequest; - - /** - * 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 AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncAnnotateFileRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest; - - /** - * 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.v1p3beta1.AsyncAnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncAnnotateFileRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncAnnotateFileRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncAnnotateFileResponse. */ - interface IAsyncAnnotateFileResponse { - - /** AsyncAnnotateFileResponse outputConfig */ - outputConfig?: (google.cloud.vision.v1p3beta1.IOutputConfig|null); - } - - /** Represents an AsyncAnnotateFileResponse. */ - class AsyncAnnotateFileResponse implements IAsyncAnnotateFileResponse { - - /** - * Constructs a new AsyncAnnotateFileResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse); - - /** AsyncAnnotateFileResponse outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p3beta1.IOutputConfig|null); - - /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncAnnotateFileResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse): google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse; - - /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.AsyncAnnotateFileResponse; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.AsyncAnnotateFileResponse; - - /** - * 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 an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncAnnotateFileResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse; - - /** - * 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.v1p3beta1.AsyncAnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncAnnotateFileResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncAnnotateFileResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateFilesRequest. */ - interface IAsyncBatchAnnotateFilesRequest { - - /** AsyncBatchAnnotateFilesRequest requests */ - requests?: (google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest[]|null); - } - - /** Represents an AsyncBatchAnnotateFilesRequest. */ - class AsyncBatchAnnotateFilesRequest implements IAsyncBatchAnnotateFilesRequest { - - /** - * Constructs a new AsyncBatchAnnotateFilesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest); - - /** AsyncBatchAnnotateFilesRequest requests. */ - public requests: google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest[]; - - /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest): google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.AsyncBatchAnnotateFilesRequest; - - /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.AsyncBatchAnnotateFilesRequest; - - /** - * 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 an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateFilesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest; - - /** - * 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.v1p3beta1.AsyncBatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateFilesResponse. */ - interface IAsyncBatchAnnotateFilesResponse { - - /** AsyncBatchAnnotateFilesResponse responses */ - responses?: (google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse[]|null); - } - - /** Represents an AsyncBatchAnnotateFilesResponse. */ - class AsyncBatchAnnotateFilesResponse implements IAsyncBatchAnnotateFilesResponse { - - /** - * Constructs a new AsyncBatchAnnotateFilesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse); - - /** AsyncBatchAnnotateFilesResponse responses. */ - public responses: google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse[]; - - /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse): google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.AsyncBatchAnnotateFilesResponse; - - /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.AsyncBatchAnnotateFilesResponse; - - /** - * 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 an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateFilesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse; - - /** - * 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.v1p3beta1.AsyncBatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InputConfig. */ - interface IInputConfig { - - /** InputConfig gcsSource */ - gcsSource?: (google.cloud.vision.v1p3beta1.IGcsSource|null); - - /** InputConfig mimeType */ - mimeType?: (string|null); - } - - /** Represents an InputConfig. */ - class InputConfig implements IInputConfig { - - /** - * Constructs a new InputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IInputConfig); - - /** InputConfig gcsSource. */ - public gcsSource?: (google.cloud.vision.v1p3beta1.IGcsSource|null); - - /** InputConfig mimeType. */ - public mimeType: string; - - /** - * Creates a new InputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns InputConfig instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IInputConfig): google.cloud.vision.v1p3beta1.InputConfig; - - /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.InputConfig; - - /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.InputConfig; - - /** - * 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 an InputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.InputConfig; - - /** - * 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.v1p3beta1.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OutputConfig. */ - interface IOutputConfig { - - /** OutputConfig gcsDestination */ - gcsDestination?: (google.cloud.vision.v1p3beta1.IGcsDestination|null); - - /** OutputConfig batchSize */ - batchSize?: (number|null); - } - - /** Represents an OutputConfig. */ - class OutputConfig implements IOutputConfig { - - /** - * Constructs a new OutputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IOutputConfig); - - /** OutputConfig gcsDestination. */ - public gcsDestination?: (google.cloud.vision.v1p3beta1.IGcsDestination|null); - - /** OutputConfig batchSize. */ - public batchSize: number; - - /** - * Creates a new OutputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns OutputConfig instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IOutputConfig): google.cloud.vision.v1p3beta1.OutputConfig; - - /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.OutputConfig; - - /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.OutputConfig; - - /** - * 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 an OutputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OutputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.OutputConfig; - - /** - * 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.v1p3beta1.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OutputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OutputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GcsSource. */ - interface IGcsSource { - - /** GcsSource uri */ - uri?: (string|null); - } - - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { - - /** - * Constructs a new GcsSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IGcsSource); - - /** GcsSource uri. */ - public uri: string; - - /** - * Creates a new GcsSource instance using the specified properties. - * @param [properties] Properties to set - * @returns GcsSource instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IGcsSource): google.cloud.vision.v1p3beta1.GcsSource; - - /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.GcsSource; - - /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.GcsSource; - - /** - * 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 GcsSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GcsSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.GcsSource; - - /** - * 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.v1p3beta1.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GcsSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GcsSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GcsDestination. */ - interface IGcsDestination { - - /** GcsDestination uri */ - uri?: (string|null); - } - - /** Represents a GcsDestination. */ - class GcsDestination implements IGcsDestination { - - /** - * Constructs a new GcsDestination. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IGcsDestination); - - /** GcsDestination uri. */ - public uri: string; - - /** - * Creates a new GcsDestination instance using the specified properties. - * @param [properties] Properties to set - * @returns GcsDestination instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IGcsDestination): google.cloud.vision.v1p3beta1.GcsDestination; - - /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.GcsDestination; - - /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.GcsDestination; - - /** - * 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 GcsDestination message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GcsDestination - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.GcsDestination; - - /** - * 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.v1p3beta1.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GcsDestination to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GcsDestination - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Likelihood enum. */ - enum Likelihood { - UNKNOWN = 0, - VERY_UNLIKELY = 1, - UNLIKELY = 2, - POSSIBLE = 3, - LIKELY = 4, - VERY_LIKELY = 5 - } - - /** Properties of an OperationMetadata. */ - interface IOperationMetadata { - - /** OperationMetadata state */ - state?: (google.cloud.vision.v1p3beta1.OperationMetadata.State|keyof typeof google.cloud.vision.v1p3beta1.OperationMetadata.State|null); - - /** OperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents an OperationMetadata. */ - class OperationMetadata implements IOperationMetadata { - - /** - * Constructs a new OperationMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IOperationMetadata); - - /** OperationMetadata state. */ - public state: (google.cloud.vision.v1p3beta1.OperationMetadata.State|keyof typeof google.cloud.vision.v1p3beta1.OperationMetadata.State); - - /** OperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** OperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationMetadata instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IOperationMetadata): google.cloud.vision.v1p3beta1.OperationMetadata; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.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.v1p3beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.v1p3beta1.OperationMetadata; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.v1p3beta1.OperationMetadata; - - /** - * 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 an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.OperationMetadata; - - /** - * 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.v1p3beta1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace OperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - CREATED = 1, - RUNNING = 2, - DONE = 3, - CANCELLED = 4 - } - } - - /** Properties of a ProductSearchParams. */ - interface IProductSearchParams { - - /** ProductSearchParams boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** ProductSearchParams productSet */ - productSet?: (string|null); - - /** ProductSearchParams productCategories */ - productCategories?: (string[]|null); - - /** ProductSearchParams filter */ - filter?: (string|null); - } - - /** Represents a ProductSearchParams. */ - class ProductSearchParams implements IProductSearchParams { - - /** - * Constructs a new ProductSearchParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IProductSearchParams); - - /** ProductSearchParams boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** ProductSearchParams productSet. */ - public productSet: string; - - /** ProductSearchParams productCategories. */ - public productCategories: string[]; - - /** ProductSearchParams filter. */ - public filter: string; - - /** - * Creates a new ProductSearchParams instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSearchParams instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IProductSearchParams): google.cloud.vision.v1p3beta1.ProductSearchParams; - - /** - * Encodes the specified ProductSearchParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchParams.verify|verify} messages. - * @param message ProductSearchParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IProductSearchParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSearchParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchParams.verify|verify} messages. - * @param message ProductSearchParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IProductSearchParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSearchParams - * @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.ProductSearchParams; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSearchParams - * @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.ProductSearchParams; - - /** - * Verifies a ProductSearchParams 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 ProductSearchParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSearchParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ProductSearchParams; - - /** - * Creates a plain object from a ProductSearchParams message. Also converts values to other types if specified. - * @param message ProductSearchParams - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ProductSearchParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSearchParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSearchParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ProductSearchResults. */ - interface IProductSearchResults { - - /** ProductSearchResults indexTime */ - indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSearchResults results */ - results?: (google.cloud.vision.v1p3beta1.ProductSearchResults.IResult[]|null); - - /** ProductSearchResults productGroupedResults */ - productGroupedResults?: (google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult[]|null); - } - - /** Represents a ProductSearchResults. */ - class ProductSearchResults implements IProductSearchResults { - - /** - * Constructs a new ProductSearchResults. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IProductSearchResults); - - /** ProductSearchResults indexTime. */ - public indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSearchResults results. */ - public results: google.cloud.vision.v1p3beta1.ProductSearchResults.IResult[]; - - /** ProductSearchResults productGroupedResults. */ - public productGroupedResults: google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult[]; - - /** - * Creates a new ProductSearchResults instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSearchResults instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IProductSearchResults): google.cloud.vision.v1p3beta1.ProductSearchResults; - - /** - * Encodes the specified ProductSearchResults message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.verify|verify} messages. - * @param message ProductSearchResults message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IProductSearchResults, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSearchResults message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.verify|verify} messages. - * @param message ProductSearchResults message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IProductSearchResults, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSearchResults - * @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.ProductSearchResults; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSearchResults - * @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.ProductSearchResults; - - /** - * Verifies a ProductSearchResults 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 ProductSearchResults message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSearchResults - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ProductSearchResults; - - /** - * Creates a plain object from a ProductSearchResults message. Also converts values to other types if specified. - * @param message ProductSearchResults - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ProductSearchResults, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSearchResults to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSearchResults - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ProductSearchResults { - - /** Properties of a Result. */ - interface IResult { - - /** Result product */ - product?: (google.cloud.vision.v1p3beta1.IProduct|null); - - /** Result score */ - score?: (number|null); - - /** Result image */ - image?: (string|null); - } - - /** Represents a Result. */ - class Result implements IResult { - - /** - * Constructs a new Result. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ProductSearchResults.IResult); - - /** Result product. */ - public product?: (google.cloud.vision.v1p3beta1.IProduct|null); - - /** Result score. */ - public score: number; - - /** Result image. */ - public image: string; - - /** - * Creates a new Result instance using the specified properties. - * @param [properties] Properties to set - * @returns Result instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ProductSearchResults.IResult): google.cloud.vision.v1p3beta1.ProductSearchResults.Result; - - /** - * Encodes the specified Result message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.Result.verify|verify} messages. - * @param message Result message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ProductSearchResults.IResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Result message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.Result.verify|verify} messages. - * @param message Result message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ProductSearchResults.IResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Result message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Result - * @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.ProductSearchResults.Result; - - /** - * Decodes a Result message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Result - * @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.ProductSearchResults.Result; - - /** - * Verifies a Result 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 Result message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Result - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ProductSearchResults.Result; - - /** - * Creates a plain object from a Result message. Also converts values to other types if specified. - * @param message Result - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ProductSearchResults.Result, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Result to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Result - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ObjectAnnotation. */ - interface IObjectAnnotation { - - /** ObjectAnnotation mid */ - mid?: (string|null); - - /** ObjectAnnotation languageCode */ - languageCode?: (string|null); - - /** ObjectAnnotation name */ - name?: (string|null); - - /** ObjectAnnotation score */ - score?: (number|null); - } - - /** Represents an ObjectAnnotation. */ - class ObjectAnnotation implements IObjectAnnotation { - - /** - * Constructs a new ObjectAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation); - - /** ObjectAnnotation mid. */ - public mid: string; - - /** ObjectAnnotation languageCode. */ - public languageCode: string; - - /** ObjectAnnotation name. */ - public name: string; - - /** ObjectAnnotation score. */ - public score: number; - - /** - * Creates a new ObjectAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns ObjectAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation): google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation; - - /** - * Encodes the specified ObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @param message ObjectAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @param message ObjectAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation; - - /** - * Verifies an ObjectAnnotation 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 ObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ObjectAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation; - - /** - * Creates a plain object from an ObjectAnnotation message. Also converts values to other types if specified. - * @param message ObjectAnnotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ObjectAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ObjectAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GroupedResult. */ - interface IGroupedResult { - - /** GroupedResult boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** GroupedResult results */ - results?: (google.cloud.vision.v1p3beta1.ProductSearchResults.IResult[]|null); - - /** GroupedResult objectAnnotations */ - objectAnnotations?: (google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation[]|null); - } - - /** Represents a GroupedResult. */ - class GroupedResult implements IGroupedResult { - - /** - * Constructs a new GroupedResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult); - - /** GroupedResult boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** GroupedResult results. */ - public results: google.cloud.vision.v1p3beta1.ProductSearchResults.IResult[]; - - /** GroupedResult objectAnnotations. */ - public objectAnnotations: google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation[]; - - /** - * Creates a new GroupedResult instance using the specified properties. - * @param [properties] Properties to set - * @returns GroupedResult instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult): google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult; - - /** - * Encodes the specified GroupedResult message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @param message GroupedResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GroupedResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @param message GroupedResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GroupedResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GroupedResult - * @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.ProductSearchResults.GroupedResult; - - /** - * Decodes a GroupedResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GroupedResult - * @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.ProductSearchResults.GroupedResult; - - /** - * Verifies a GroupedResult 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 GroupedResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GroupedResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult; - - /** - * Creates a plain object from a GroupedResult message. Also converts values to other types if specified. - * @param message GroupedResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GroupedResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GroupedResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Represents a ProductSearch */ - class ProductSearch extends $protobuf.rpc.Service { - - /** - * Constructs a new ProductSearch 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); - - /** - * Creates new ProductSearch 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): ProductSearch; - - /** - * Calls CreateProductSet. - * @param request CreateProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public createProductSet(request: google.cloud.vision.v1p3beta1.ICreateProductSetRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.CreateProductSetCallback): void; - - /** - * Calls CreateProductSet. - * @param request CreateProductSetRequest message or plain object - * @returns Promise - */ - public createProductSet(request: google.cloud.vision.v1p3beta1.ICreateProductSetRequest): Promise; - - /** - * Calls ListProductSets. - * @param request ListProductSetsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductSetsResponse - */ - public listProductSets(request: google.cloud.vision.v1p3beta1.IListProductSetsRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.ListProductSetsCallback): void; - - /** - * Calls ListProductSets. - * @param request ListProductSetsRequest message or plain object - * @returns Promise - */ - public listProductSets(request: google.cloud.vision.v1p3beta1.IListProductSetsRequest): Promise; - - /** - * Calls GetProductSet. - * @param request GetProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public getProductSet(request: google.cloud.vision.v1p3beta1.IGetProductSetRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.GetProductSetCallback): void; - - /** - * Calls GetProductSet. - * @param request GetProductSetRequest message or plain object - * @returns Promise - */ - public getProductSet(request: google.cloud.vision.v1p3beta1.IGetProductSetRequest): Promise; - - /** - * Calls UpdateProductSet. - * @param request UpdateProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public updateProductSet(request: google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.UpdateProductSetCallback): void; - - /** - * Calls UpdateProductSet. - * @param request UpdateProductSetRequest message or plain object - * @returns Promise - */ - public updateProductSet(request: google.cloud.vision.v1p3beta1.IUpdateProductSetRequest): Promise; - - /** - * Calls DeleteProductSet. - * @param request DeleteProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteProductSet(request: google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.DeleteProductSetCallback): void; - - /** - * Calls DeleteProductSet. - * @param request DeleteProductSetRequest message or plain object - * @returns Promise - */ - public deleteProductSet(request: google.cloud.vision.v1p3beta1.IDeleteProductSetRequest): Promise; - - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public createProduct(request: google.cloud.vision.v1p3beta1.ICreateProductRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.CreateProductCallback): void; - - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise - */ - public createProduct(request: google.cloud.vision.v1p3beta1.ICreateProductRequest): Promise; - - /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsResponse - */ - public listProducts(request: google.cloud.vision.v1p3beta1.IListProductsRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.ListProductsCallback): void; - - /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @returns Promise - */ - public listProducts(request: google.cloud.vision.v1p3beta1.IListProductsRequest): Promise; - - /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public getProduct(request: google.cloud.vision.v1p3beta1.IGetProductRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.GetProductCallback): void; - - /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise - */ - public getProduct(request: google.cloud.vision.v1p3beta1.IGetProductRequest): Promise; - - /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public updateProduct(request: google.cloud.vision.v1p3beta1.IUpdateProductRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.UpdateProductCallback): void; - - /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise - */ - public updateProduct(request: google.cloud.vision.v1p3beta1.IUpdateProductRequest): Promise; - - /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteProduct(request: google.cloud.vision.v1p3beta1.IDeleteProductRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.DeleteProductCallback): void; - - /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise - */ - public deleteProduct(request: google.cloud.vision.v1p3beta1.IDeleteProductRequest): Promise; - - /** - * Calls CreateReferenceImage. - * @param request CreateReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ReferenceImage - */ - public createReferenceImage(request: google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.CreateReferenceImageCallback): void; - - /** - * Calls CreateReferenceImage. - * @param request CreateReferenceImageRequest message or plain object - * @returns Promise - */ - public createReferenceImage(request: google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest): Promise; - - /** - * Calls DeleteReferenceImage. - * @param request DeleteReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteReferenceImage(request: google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.DeleteReferenceImageCallback): void; - - /** - * Calls DeleteReferenceImage. - * @param request DeleteReferenceImageRequest message or plain object - * @returns Promise - */ - public deleteReferenceImage(request: google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest): Promise; - - /** - * Calls ListReferenceImages. - * @param request ListReferenceImagesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListReferenceImagesResponse - */ - public listReferenceImages(request: google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.ListReferenceImagesCallback): void; - - /** - * Calls ListReferenceImages. - * @param request ListReferenceImagesRequest message or plain object - * @returns Promise - */ - public listReferenceImages(request: google.cloud.vision.v1p3beta1.IListReferenceImagesRequest): Promise; - - /** - * Calls GetReferenceImage. - * @param request GetReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ReferenceImage - */ - public getReferenceImage(request: google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.GetReferenceImageCallback): void; - - /** - * Calls GetReferenceImage. - * @param request GetReferenceImageRequest message or plain object - * @returns Promise - */ - public getReferenceImage(request: google.cloud.vision.v1p3beta1.IGetReferenceImageRequest): Promise; - - /** - * Calls AddProductToProductSet. - * @param request AddProductToProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public addProductToProductSet(request: google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.AddProductToProductSetCallback): void; - - /** - * Calls AddProductToProductSet. - * @param request AddProductToProductSetRequest message or plain object - * @returns Promise - */ - public addProductToProductSet(request: google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest): Promise; - - /** - * Calls RemoveProductFromProductSet. - * @param request RemoveProductFromProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public removeProductFromProductSet(request: google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.RemoveProductFromProductSetCallback): void; - - /** - * Calls RemoveProductFromProductSet. - * @param request RemoveProductFromProductSetRequest message or plain object - * @returns Promise - */ - public removeProductFromProductSet(request: google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest): Promise; - - /** - * Calls ListProductsInProductSet. - * @param request ListProductsInProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsInProductSetResponse - */ - public listProductsInProductSet(request: google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.ListProductsInProductSetCallback): void; - - /** - * Calls ListProductsInProductSet. - * @param request ListProductsInProductSetRequest message or plain object - * @returns Promise - */ - public listProductsInProductSet(request: google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest): Promise; - - /** - * Calls ImportProductSets. - * @param request ImportProductSetsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public importProductSets(request: google.cloud.vision.v1p3beta1.IImportProductSetsRequest, callback: google.cloud.vision.v1p3beta1.ProductSearch.ImportProductSetsCallback): void; - - /** - * Calls ImportProductSets. - * @param request ImportProductSetsRequest message or plain object - * @returns Promise - */ - public importProductSets(request: google.cloud.vision.v1p3beta1.IImportProductSetsRequest): Promise; - } - - namespace ProductSearch { - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|createProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type CreateProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|listProductSets}. - * @param error Error, if any - * @param [response] ListProductSetsResponse - */ - type ListProductSetsCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ListProductSetsResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|getProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type GetProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|updateProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type UpdateProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|deleteProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|createProduct}. - * @param error Error, if any - * @param [response] Product - */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|listProducts}. - * @param error Error, if any - * @param [response] ListProductsResponse - */ - type ListProductsCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ListProductsResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|getProduct}. - * @param error Error, if any - * @param [response] Product - */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|updateProduct}. - * @param error Error, if any - * @param [response] Product - */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|deleteProduct}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|createReferenceImage}. - * @param error Error, if any - * @param [response] ReferenceImage - */ - type CreateReferenceImageCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ReferenceImage) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|deleteReferenceImage}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteReferenceImageCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|listReferenceImages}. - * @param error Error, if any - * @param [response] ListReferenceImagesResponse - */ - type ListReferenceImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ListReferenceImagesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|getReferenceImage}. - * @param error Error, if any - * @param [response] ReferenceImage - */ - type GetReferenceImageCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ReferenceImage) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|addProductToProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type AddProductToProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|removeProductFromProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type RemoveProductFromProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|listProductsInProductSet}. - * @param error Error, if any - * @param [response] ListProductsInProductSetResponse - */ - type ListProductsInProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|importProductSets}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportProductSetsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a Product. */ - interface IProduct { - - /** Product name */ - name?: (string|null); - - /** Product displayName */ - displayName?: (string|null); - - /** Product description */ - description?: (string|null); - - /** Product productCategory */ - productCategory?: (string|null); - - /** Product productLabels */ - productLabels?: (google.cloud.vision.v1p3beta1.Product.IKeyValue[]|null); - } - - /** Represents a Product. */ - class Product implements IProduct { - - /** - * Constructs a new Product. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IProduct); - - /** Product name. */ - public name: string; - - /** Product displayName. */ - public displayName: string; - - /** Product description. */ - public description: string; - - /** Product productCategory. */ - public productCategory: string; - - /** Product productLabels. */ - public productLabels: google.cloud.vision.v1p3beta1.Product.IKeyValue[]; - - /** - * Creates a new Product instance using the specified properties. - * @param [properties] Properties to set - * @returns Product instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IProduct): google.cloud.vision.v1p3beta1.Product; - - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Product message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Product - * @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.Product; - - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Product - * @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.Product; - - /** - * Verifies a Product 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 Product message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Product - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Product; - - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Product to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Product - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Product { - - /** Properties of a KeyValue. */ - interface IKeyValue { - - /** KeyValue key */ - key?: (string|null); - - /** KeyValue value */ - value?: (string|null); - } - - /** Represents a KeyValue. */ - class KeyValue implements IKeyValue { - - /** - * Constructs a new KeyValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.Product.IKeyValue); - - /** KeyValue key. */ - public key: string; - - /** KeyValue value. */ - public value: string; - - /** - * Creates a new KeyValue instance using the specified properties. - * @param [properties] Properties to set - * @returns KeyValue instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.Product.IKeyValue): google.cloud.vision.v1p3beta1.Product.KeyValue; - - /** - * Encodes the specified KeyValue message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Product.KeyValue.verify|verify} messages. - * @param message KeyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.Product.IKeyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Product.KeyValue.verify|verify} messages. - * @param message KeyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.Product.IKeyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a KeyValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns KeyValue - * @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.Product.KeyValue; - - /** - * Decodes a KeyValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns KeyValue - * @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.Product.KeyValue; - - /** - * Verifies a KeyValue 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 KeyValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns KeyValue - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Product.KeyValue; - - /** - * Creates a plain object from a KeyValue message. Also converts values to other types if specified. - * @param message KeyValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Product.KeyValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this KeyValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for KeyValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a ProductSet. */ - interface IProductSet { - - /** ProductSet name */ - name?: (string|null); - - /** ProductSet displayName */ - displayName?: (string|null); - - /** ProductSet indexTime */ - indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSet indexError */ - indexError?: (google.rpc.IStatus|null); - } - - /** Represents a ProductSet. */ - class ProductSet implements IProductSet { - - /** - * Constructs a new ProductSet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IProductSet); - - /** ProductSet name. */ - public name: string; - - /** ProductSet displayName. */ - public displayName: string; - - /** ProductSet indexTime. */ - public indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSet indexError. */ - public indexError?: (google.rpc.IStatus|null); - - /** - * Creates a new ProductSet instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSet instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IProductSet): google.cloud.vision.v1p3beta1.ProductSet; - - /** - * Encodes the specified ProductSet message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSet.verify|verify} messages. - * @param message ProductSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IProductSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSet message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSet.verify|verify} messages. - * @param message ProductSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IProductSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSet - * @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.ProductSet; - - /** - * Decodes a ProductSet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSet - * @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.ProductSet; - - /** - * Verifies a ProductSet 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 ProductSet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ProductSet; - - /** - * Creates a plain object from a ProductSet message. Also converts values to other types if specified. - * @param message ProductSet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ProductSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSet - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReferenceImage. */ - interface IReferenceImage { - - /** ReferenceImage name */ - name?: (string|null); - - /** ReferenceImage uri */ - uri?: (string|null); - - /** ReferenceImage boundingPolys */ - boundingPolys?: (google.cloud.vision.v1p3beta1.IBoundingPoly[]|null); - } - - /** Represents a ReferenceImage. */ - class ReferenceImage implements IReferenceImage { - - /** - * Constructs a new ReferenceImage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IReferenceImage); - - /** ReferenceImage name. */ - public name: string; - - /** ReferenceImage uri. */ - public uri: string; - - /** ReferenceImage boundingPolys. */ - public boundingPolys: google.cloud.vision.v1p3beta1.IBoundingPoly[]; - - /** - * Creates a new ReferenceImage instance using the specified properties. - * @param [properties] Properties to set - * @returns ReferenceImage instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IReferenceImage): google.cloud.vision.v1p3beta1.ReferenceImage; - - /** - * Encodes the specified ReferenceImage message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ReferenceImage.verify|verify} messages. - * @param message ReferenceImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IReferenceImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReferenceImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ReferenceImage.verify|verify} messages. - * @param message ReferenceImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IReferenceImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReferenceImage - * @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.ReferenceImage; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReferenceImage - * @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.ReferenceImage; - - /** - * Verifies a ReferenceImage 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 ReferenceImage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReferenceImage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ReferenceImage; - - /** - * Creates a plain object from a ReferenceImage message. Also converts values to other types if specified. - * @param message ReferenceImage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ReferenceImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReferenceImage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReferenceImage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { - - /** CreateProductRequest parent */ - parent?: (string|null); - - /** CreateProductRequest product */ - product?: (google.cloud.vision.v1p3beta1.IProduct|null); - - /** CreateProductRequest productId */ - productId?: (string|null); - } - - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { - - /** - * Constructs a new CreateProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ICreateProductRequest); - - /** CreateProductRequest parent. */ - public parent: string; - - /** CreateProductRequest product. */ - public product?: (google.cloud.vision.v1p3beta1.IProduct|null); - - /** CreateProductRequest productId. */ - public productId: string; - - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ICreateProductRequest): google.cloud.vision.v1p3beta1.CreateProductRequest; - - /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateProductRequest - * @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.CreateProductRequest; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateProductRequest - * @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.CreateProductRequest; - - /** - * Verifies a CreateProductRequest 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 CreateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.CreateProductRequest; - - /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsRequest. */ - interface IListProductsRequest { - - /** ListProductsRequest parent */ - parent?: (string|null); - - /** ListProductsRequest pageSize */ - pageSize?: (number|null); - - /** ListProductsRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductsRequest. */ - class ListProductsRequest implements IListProductsRequest { - - /** - * Constructs a new ListProductsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IListProductsRequest); - - /** ListProductsRequest parent. */ - public parent: string; - - /** ListProductsRequest pageSize. */ - public pageSize: number; - - /** ListProductsRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IListProductsRequest): google.cloud.vision.v1p3beta1.ListProductsRequest; - - /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsRequest - * @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.ListProductsRequest; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsRequest - * @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.ListProductsRequest; - - /** - * Verifies a ListProductsRequest 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 ListProductsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ListProductsRequest; - - /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. - * @param message ListProductsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsResponse. */ - interface IListProductsResponse { - - /** ListProductsResponse products */ - products?: (google.cloud.vision.v1p3beta1.IProduct[]|null); - - /** ListProductsResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductsResponse. */ - class ListProductsResponse implements IListProductsResponse { - - /** - * Constructs a new ListProductsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IListProductsResponse); - - /** ListProductsResponse products. */ - public products: google.cloud.vision.v1p3beta1.IProduct[]; - - /** ListProductsResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IListProductsResponse): google.cloud.vision.v1p3beta1.ListProductsResponse; - - /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsResponse - * @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.ListProductsResponse; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsResponse - * @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.ListProductsResponse; - - /** - * Verifies a ListProductsResponse 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 ListProductsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ListProductsResponse; - - /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. - * @param message ListProductsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { - - /** GetProductRequest name */ - name?: (string|null); - } - - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { - - /** - * Constructs a new GetProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IGetProductRequest); - - /** GetProductRequest name. */ - public name: string; - - /** - * Creates a new GetProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IGetProductRequest): google.cloud.vision.v1p3beta1.GetProductRequest; - - /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetProductRequest - * @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.GetProductRequest; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetProductRequest - * @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.GetProductRequest; - - /** - * Verifies a GetProductRequest 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 GetProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.GetProductRequest; - - /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { - - /** UpdateProductRequest product */ - product?: (google.cloud.vision.v1p3beta1.IProduct|null); - - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { - - /** - * Constructs a new UpdateProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IUpdateProductRequest); - - /** UpdateProductRequest product. */ - public product?: (google.cloud.vision.v1p3beta1.IProduct|null); - - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IUpdateProductRequest): google.cloud.vision.v1p3beta1.UpdateProductRequest; - - /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateProductRequest - * @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.UpdateProductRequest; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest - * @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.UpdateProductRequest; - - /** - * Verifies an UpdateProductRequest 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 UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.UpdateProductRequest; - - /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UpdateProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UpdateProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { - - /** DeleteProductRequest name */ - name?: (string|null); - } - - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { - - /** - * Constructs a new DeleteProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IDeleteProductRequest); - - /** DeleteProductRequest name. */ - public name: string; - - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IDeleteProductRequest): google.cloud.vision.v1p3beta1.DeleteProductRequest; - - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteProductRequest - * @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.DeleteProductRequest; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest - * @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.DeleteProductRequest; - - /** - * Verifies a DeleteProductRequest 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 DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.DeleteProductRequest; - - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateProductSetRequest. */ - interface ICreateProductSetRequest { - - /** CreateProductSetRequest parent */ - parent?: (string|null); - - /** CreateProductSetRequest productSet */ - productSet?: (google.cloud.vision.v1p3beta1.IProductSet|null); - - /** CreateProductSetRequest productSetId */ - productSetId?: (string|null); - } - - /** Represents a CreateProductSetRequest. */ - class CreateProductSetRequest implements ICreateProductSetRequest { - - /** - * Constructs a new CreateProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ICreateProductSetRequest); - - /** CreateProductSetRequest parent. */ - public parent: string; - - /** CreateProductSetRequest productSet. */ - public productSet?: (google.cloud.vision.v1p3beta1.IProductSet|null); - - /** CreateProductSetRequest productSetId. */ - public productSetId: string; - - /** - * Creates a new CreateProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ICreateProductSetRequest): google.cloud.vision.v1p3beta1.CreateProductSetRequest; - - /** - * Encodes the specified CreateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateProductSetRequest.verify|verify} messages. - * @param message CreateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ICreateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateProductSetRequest.verify|verify} messages. - * @param message CreateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ICreateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateProductSetRequest - * @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.CreateProductSetRequest; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateProductSetRequest - * @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.CreateProductSetRequest; - - /** - * Verifies a CreateProductSetRequest 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 CreateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.CreateProductSetRequest; - - /** - * Creates a plain object from a CreateProductSetRequest message. Also converts values to other types if specified. - * @param message CreateProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.CreateProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductSetsRequest. */ - interface IListProductSetsRequest { - - /** ListProductSetsRequest parent */ - parent?: (string|null); - - /** ListProductSetsRequest pageSize */ - pageSize?: (number|null); - - /** ListProductSetsRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductSetsRequest. */ - class ListProductSetsRequest implements IListProductSetsRequest { - - /** - * Constructs a new ListProductSetsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IListProductSetsRequest); - - /** ListProductSetsRequest parent. */ - public parent: string; - - /** ListProductSetsRequest pageSize. */ - public pageSize: number; - - /** ListProductSetsRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductSetsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductSetsRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IListProductSetsRequest): google.cloud.vision.v1p3beta1.ListProductSetsRequest; - - /** - * Encodes the specified ListProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductSetsRequest.verify|verify} messages. - * @param message ListProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IListProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductSetsRequest.verify|verify} messages. - * @param message ListProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IListProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductSetsRequest - * @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.ListProductSetsRequest; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductSetsRequest - * @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.ListProductSetsRequest; - - /** - * Verifies a ListProductSetsRequest 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 ListProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductSetsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ListProductSetsRequest; - - /** - * Creates a plain object from a ListProductSetsRequest message. Also converts values to other types if specified. - * @param message ListProductSetsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ListProductSetsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductSetsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductSetsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductSetsResponse. */ - interface IListProductSetsResponse { - - /** ListProductSetsResponse productSets */ - productSets?: (google.cloud.vision.v1p3beta1.IProductSet[]|null); - - /** ListProductSetsResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductSetsResponse. */ - class ListProductSetsResponse implements IListProductSetsResponse { - - /** - * Constructs a new ListProductSetsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IListProductSetsResponse); - - /** ListProductSetsResponse productSets. */ - public productSets: google.cloud.vision.v1p3beta1.IProductSet[]; - - /** ListProductSetsResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductSetsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductSetsResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IListProductSetsResponse): google.cloud.vision.v1p3beta1.ListProductSetsResponse; - - /** - * Encodes the specified ListProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductSetsResponse.verify|verify} messages. - * @param message ListProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IListProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductSetsResponse.verify|verify} messages. - * @param message ListProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IListProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductSetsResponse - * @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.ListProductSetsResponse; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductSetsResponse - * @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.ListProductSetsResponse; - - /** - * Verifies a ListProductSetsResponse 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 ListProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductSetsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ListProductSetsResponse; - - /** - * Creates a plain object from a ListProductSetsResponse message. Also converts values to other types if specified. - * @param message ListProductSetsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ListProductSetsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductSetsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductSetsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetProductSetRequest. */ - interface IGetProductSetRequest { - - /** GetProductSetRequest name */ - name?: (string|null); - } - - /** Represents a GetProductSetRequest. */ - class GetProductSetRequest implements IGetProductSetRequest { - - /** - * Constructs a new GetProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IGetProductSetRequest); - - /** GetProductSetRequest name. */ - public name: string; - - /** - * Creates a new GetProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IGetProductSetRequest): google.cloud.vision.v1p3beta1.GetProductSetRequest; - - /** - * Encodes the specified GetProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetProductSetRequest.verify|verify} messages. - * @param message GetProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IGetProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetProductSetRequest.verify|verify} messages. - * @param message GetProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IGetProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetProductSetRequest - * @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.GetProductSetRequest; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetProductSetRequest - * @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.GetProductSetRequest; - - /** - * Verifies a GetProductSetRequest 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 GetProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.GetProductSetRequest; - - /** - * Creates a plain object from a GetProductSetRequest message. Also converts values to other types if specified. - * @param message GetProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.GetProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an UpdateProductSetRequest. */ - interface IUpdateProductSetRequest { - - /** UpdateProductSetRequest productSet */ - productSet?: (google.cloud.vision.v1p3beta1.IProductSet|null); - - /** UpdateProductSetRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateProductSetRequest. */ - class UpdateProductSetRequest implements IUpdateProductSetRequest { - - /** - * Constructs a new UpdateProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IUpdateProductSetRequest); - - /** UpdateProductSetRequest productSet. */ - public productSet?: (google.cloud.vision.v1p3beta1.IProductSet|null); - - /** UpdateProductSetRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** - * Creates a new UpdateProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IUpdateProductSetRequest): google.cloud.vision.v1p3beta1.UpdateProductSetRequest; - - /** - * Encodes the specified UpdateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.UpdateProductSetRequest.verify|verify} messages. - * @param message UpdateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.UpdateProductSetRequest.verify|verify} messages. - * @param message UpdateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateProductSetRequest - * @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.UpdateProductSetRequest; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateProductSetRequest - * @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.UpdateProductSetRequest; - - /** - * Verifies an UpdateProductSetRequest 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 UpdateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.UpdateProductSetRequest; - - /** - * Creates a plain object from an UpdateProductSetRequest message. Also converts values to other types if specified. - * @param message UpdateProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.UpdateProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UpdateProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UpdateProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteProductSetRequest. */ - interface IDeleteProductSetRequest { - - /** DeleteProductSetRequest name */ - name?: (string|null); - } - - /** Represents a DeleteProductSetRequest. */ - class DeleteProductSetRequest implements IDeleteProductSetRequest { - - /** - * Constructs a new DeleteProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IDeleteProductSetRequest); - - /** DeleteProductSetRequest name. */ - public name: string; - - /** - * Creates a new DeleteProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IDeleteProductSetRequest): google.cloud.vision.v1p3beta1.DeleteProductSetRequest; - - /** - * Encodes the specified DeleteProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteProductSetRequest.verify|verify} messages. - * @param message DeleteProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteProductSetRequest.verify|verify} messages. - * @param message DeleteProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteProductSetRequest - * @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.DeleteProductSetRequest; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteProductSetRequest - * @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.DeleteProductSetRequest; - - /** - * Verifies a DeleteProductSetRequest 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 DeleteProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.DeleteProductSetRequest; - - /** - * Creates a plain object from a DeleteProductSetRequest message. Also converts values to other types if specified. - * @param message DeleteProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.DeleteProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateReferenceImageRequest. */ - interface ICreateReferenceImageRequest { - - /** CreateReferenceImageRequest parent */ - parent?: (string|null); - - /** CreateReferenceImageRequest referenceImage */ - referenceImage?: (google.cloud.vision.v1p3beta1.IReferenceImage|null); - - /** CreateReferenceImageRequest referenceImageId */ - referenceImageId?: (string|null); - } - - /** Represents a CreateReferenceImageRequest. */ - class CreateReferenceImageRequest implements ICreateReferenceImageRequest { - - /** - * Constructs a new CreateReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest); - - /** CreateReferenceImageRequest parent. */ - public parent: string; - - /** CreateReferenceImageRequest referenceImage. */ - public referenceImage?: (google.cloud.vision.v1p3beta1.IReferenceImage|null); - - /** CreateReferenceImageRequest referenceImageId. */ - public referenceImageId: string; - - /** - * Creates a new CreateReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest): google.cloud.vision.v1p3beta1.CreateReferenceImageRequest; - - /** - * Encodes the specified CreateReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateReferenceImageRequest.verify|verify} messages. - * @param message CreateReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateReferenceImageRequest.verify|verify} messages. - * @param message CreateReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateReferenceImageRequest - * @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.CreateReferenceImageRequest; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateReferenceImageRequest - * @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.CreateReferenceImageRequest; - - /** - * Verifies a CreateReferenceImageRequest 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 CreateReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.CreateReferenceImageRequest; - - /** - * Creates a plain object from a CreateReferenceImageRequest message. Also converts values to other types if specified. - * @param message CreateReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.CreateReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListReferenceImagesRequest. */ - interface IListReferenceImagesRequest { - - /** ListReferenceImagesRequest parent */ - parent?: (string|null); - - /** ListReferenceImagesRequest pageSize */ - pageSize?: (number|null); - - /** ListReferenceImagesRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListReferenceImagesRequest. */ - class ListReferenceImagesRequest implements IListReferenceImagesRequest { - - /** - * Constructs a new ListReferenceImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IListReferenceImagesRequest); - - /** ListReferenceImagesRequest parent. */ - public parent: string; - - /** ListReferenceImagesRequest pageSize. */ - public pageSize: number; - - /** ListReferenceImagesRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListReferenceImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListReferenceImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IListReferenceImagesRequest): google.cloud.vision.v1p3beta1.ListReferenceImagesRequest; - - /** - * Encodes the specified ListReferenceImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListReferenceImagesRequest.verify|verify} messages. - * @param message ListReferenceImagesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListReferenceImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListReferenceImagesRequest.verify|verify} messages. - * @param message ListReferenceImagesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListReferenceImagesRequest - * @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.ListReferenceImagesRequest; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListReferenceImagesRequest - * @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.ListReferenceImagesRequest; - - /** - * Verifies a ListReferenceImagesRequest 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 ListReferenceImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListReferenceImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ListReferenceImagesRequest; - - /** - * Creates a plain object from a ListReferenceImagesRequest message. Also converts values to other types if specified. - * @param message ListReferenceImagesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ListReferenceImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListReferenceImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListReferenceImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListReferenceImagesResponse. */ - interface IListReferenceImagesResponse { - - /** ListReferenceImagesResponse referenceImages */ - referenceImages?: (google.cloud.vision.v1p3beta1.IReferenceImage[]|null); - - /** ListReferenceImagesResponse pageSize */ - pageSize?: (number|null); - - /** ListReferenceImagesResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListReferenceImagesResponse. */ - class ListReferenceImagesResponse implements IListReferenceImagesResponse { - - /** - * Constructs a new ListReferenceImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IListReferenceImagesResponse); - - /** ListReferenceImagesResponse referenceImages. */ - public referenceImages: google.cloud.vision.v1p3beta1.IReferenceImage[]; - - /** ListReferenceImagesResponse pageSize. */ - public pageSize: number; - - /** ListReferenceImagesResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListReferenceImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListReferenceImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IListReferenceImagesResponse): google.cloud.vision.v1p3beta1.ListReferenceImagesResponse; - - /** - * Encodes the specified ListReferenceImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListReferenceImagesResponse.verify|verify} messages. - * @param message ListReferenceImagesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IListReferenceImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListReferenceImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListReferenceImagesResponse.verify|verify} messages. - * @param message ListReferenceImagesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IListReferenceImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListReferenceImagesResponse - * @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.ListReferenceImagesResponse; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListReferenceImagesResponse - * @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.ListReferenceImagesResponse; - - /** - * Verifies a ListReferenceImagesResponse 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 ListReferenceImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListReferenceImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ListReferenceImagesResponse; - - /** - * Creates a plain object from a ListReferenceImagesResponse message. Also converts values to other types if specified. - * @param message ListReferenceImagesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ListReferenceImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListReferenceImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListReferenceImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetReferenceImageRequest. */ - interface IGetReferenceImageRequest { - - /** GetReferenceImageRequest name */ - name?: (string|null); - } - - /** Represents a GetReferenceImageRequest. */ - class GetReferenceImageRequest implements IGetReferenceImageRequest { - - /** - * Constructs a new GetReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IGetReferenceImageRequest); - - /** GetReferenceImageRequest name. */ - public name: string; - - /** - * Creates a new GetReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IGetReferenceImageRequest): google.cloud.vision.v1p3beta1.GetReferenceImageRequest; - - /** - * Encodes the specified GetReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetReferenceImageRequest.verify|verify} messages. - * @param message GetReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetReferenceImageRequest.verify|verify} messages. - * @param message GetReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetReferenceImageRequest - * @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.GetReferenceImageRequest; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetReferenceImageRequest - * @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.GetReferenceImageRequest; - - /** - * Verifies a GetReferenceImageRequest 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 GetReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.GetReferenceImageRequest; - - /** - * Creates a plain object from a GetReferenceImageRequest message. Also converts values to other types if specified. - * @param message GetReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.GetReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteReferenceImageRequest. */ - interface IDeleteReferenceImageRequest { - - /** DeleteReferenceImageRequest name */ - name?: (string|null); - } - - /** Represents a DeleteReferenceImageRequest. */ - class DeleteReferenceImageRequest implements IDeleteReferenceImageRequest { - - /** - * Constructs a new DeleteReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest); - - /** DeleteReferenceImageRequest name. */ - public name: string; - - /** - * Creates a new DeleteReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest): google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest; - - /** - * Encodes the specified DeleteReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest.verify|verify} messages. - * @param message DeleteReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest.verify|verify} messages. - * @param message DeleteReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest; - - /** - * Verifies a DeleteReferenceImageRequest 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 DeleteReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest; - - /** - * Creates a plain object from a DeleteReferenceImageRequest message. Also converts values to other types if specified. - * @param message DeleteReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AddProductToProductSetRequest. */ - interface IAddProductToProductSetRequest { - - /** AddProductToProductSetRequest name */ - name?: (string|null); - - /** AddProductToProductSetRequest product */ - product?: (string|null); - } - - /** Represents an AddProductToProductSetRequest. */ - class AddProductToProductSetRequest implements IAddProductToProductSetRequest { - - /** - * Constructs a new AddProductToProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest); - - /** AddProductToProductSetRequest name. */ - public name: string; - - /** AddProductToProductSetRequest product. */ - public product: string; - - /** - * Creates a new AddProductToProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AddProductToProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest): google.cloud.vision.v1p3beta1.AddProductToProductSetRequest; - - /** - * Encodes the specified AddProductToProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AddProductToProductSetRequest.verify|verify} messages. - * @param message AddProductToProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AddProductToProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AddProductToProductSetRequest.verify|verify} messages. - * @param message AddProductToProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AddProductToProductSetRequest - * @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.AddProductToProductSetRequest; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AddProductToProductSetRequest - * @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.AddProductToProductSetRequest; - - /** - * Verifies an AddProductToProductSetRequest 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 AddProductToProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AddProductToProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.AddProductToProductSetRequest; - - /** - * Creates a plain object from an AddProductToProductSetRequest message. Also converts values to other types if specified. - * @param message AddProductToProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.AddProductToProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AddProductToProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AddProductToProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RemoveProductFromProductSetRequest. */ - interface IRemoveProductFromProductSetRequest { - - /** RemoveProductFromProductSetRequest name */ - name?: (string|null); - - /** RemoveProductFromProductSetRequest product */ - product?: (string|null); - } - - /** Represents a RemoveProductFromProductSetRequest. */ - class RemoveProductFromProductSetRequest implements IRemoveProductFromProductSetRequest { - - /** - * Constructs a new RemoveProductFromProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest); - - /** RemoveProductFromProductSetRequest name. */ - public name: string; - - /** RemoveProductFromProductSetRequest product. */ - public product: string; - - /** - * Creates a new RemoveProductFromProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns RemoveProductFromProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest): google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @param message RemoveProductFromProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @param message RemoveProductFromProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest; - - /** - * Verifies a RemoveProductFromProductSetRequest 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 RemoveProductFromProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RemoveProductFromProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest; - - /** - * Creates a plain object from a RemoveProductFromProductSetRequest message. Also converts values to other types if specified. - * @param message RemoveProductFromProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RemoveProductFromProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RemoveProductFromProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsInProductSetRequest. */ - interface IListProductsInProductSetRequest { - - /** ListProductsInProductSetRequest name */ - name?: (string|null); - - /** ListProductsInProductSetRequest pageSize */ - pageSize?: (number|null); - - /** ListProductsInProductSetRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductsInProductSetRequest. */ - class ListProductsInProductSetRequest implements IListProductsInProductSetRequest { - - /** - * Constructs a new ListProductsInProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest); - - /** ListProductsInProductSetRequest name. */ - public name: string; - - /** ListProductsInProductSetRequest pageSize. */ - public pageSize: number; - - /** ListProductsInProductSetRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductsInProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsInProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest): google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest; - - /** - * Encodes the specified ListProductsInProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest.verify|verify} messages. - * @param message ListProductsInProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsInProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest.verify|verify} messages. - * @param message ListProductsInProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest; - - /** - * Verifies a ListProductsInProductSetRequest 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 ListProductsInProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsInProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest; - - /** - * Creates a plain object from a ListProductsInProductSetRequest message. Also converts values to other types if specified. - * @param message ListProductsInProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsInProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsInProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsInProductSetResponse. */ - interface IListProductsInProductSetResponse { - - /** ListProductsInProductSetResponse products */ - products?: (google.cloud.vision.v1p3beta1.IProduct[]|null); - - /** ListProductsInProductSetResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductsInProductSetResponse. */ - class ListProductsInProductSetResponse implements IListProductsInProductSetResponse { - - /** - * Constructs a new ListProductsInProductSetResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse); - - /** ListProductsInProductSetResponse products. */ - public products: google.cloud.vision.v1p3beta1.IProduct[]; - - /** ListProductsInProductSetResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductsInProductSetResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsInProductSetResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse): google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse; - - /** - * Encodes the specified ListProductsInProductSetResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse.verify|verify} messages. - * @param message ListProductsInProductSetResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsInProductSetResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse.verify|verify} messages. - * @param message ListProductsInProductSetResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse; - - /** - * Verifies a ListProductsInProductSetResponse 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 ListProductsInProductSetResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsInProductSetResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse; - - /** - * Creates a plain object from a ListProductsInProductSetResponse message. Also converts values to other types if specified. - * @param message ListProductsInProductSetResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsInProductSetResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsInProductSetResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsGcsSource. */ - interface IImportProductSetsGcsSource { - - /** ImportProductSetsGcsSource csvFileUri */ - csvFileUri?: (string|null); - } - - /** Represents an ImportProductSetsGcsSource. */ - class ImportProductSetsGcsSource implements IImportProductSetsGcsSource { - - /** - * Constructs a new ImportProductSetsGcsSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource); - - /** ImportProductSetsGcsSource csvFileUri. */ - public csvFileUri: string; - - /** - * Creates a new ImportProductSetsGcsSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsGcsSource instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource): google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource; - - /** - * Encodes the specified ImportProductSetsGcsSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.verify|verify} messages. - * @param message ImportProductSetsGcsSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsGcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.verify|verify} messages. - * @param message ImportProductSetsGcsSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource; - - /** - * Verifies an ImportProductSetsGcsSource 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 ImportProductSetsGcsSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsGcsSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource; - - /** - * Creates a plain object from an ImportProductSetsGcsSource message. Also converts values to other types if specified. - * @param message ImportProductSetsGcsSource - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsGcsSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsGcsSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsInputConfig. */ - interface IImportProductSetsInputConfig { - - /** ImportProductSetsInputConfig gcsSource */ - gcsSource?: (google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource|null); - } - - /** Represents an ImportProductSetsInputConfig. */ - class ImportProductSetsInputConfig implements IImportProductSetsInputConfig { - - /** - * Constructs a new ImportProductSetsInputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig); - - /** ImportProductSetsInputConfig gcsSource. */ - public gcsSource?: (google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource|null); - - /** ImportProductSetsInputConfig source. */ - public source?: "gcsSource"; - - /** - * Creates a new ImportProductSetsInputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsInputConfig instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig): google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig; - - /** - * Encodes the specified ImportProductSetsInputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.verify|verify} messages. - * @param message ImportProductSetsInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsInputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.verify|verify} messages. - * @param message ImportProductSetsInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig; - - /** - * Verifies an ImportProductSetsInputConfig 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 ImportProductSetsInputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsInputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig; - - /** - * Creates a plain object from an ImportProductSetsInputConfig message. Also converts values to other types if specified. - * @param message ImportProductSetsInputConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsInputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsInputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsRequest. */ - interface IImportProductSetsRequest { - - /** ImportProductSetsRequest parent */ - parent?: (string|null); - - /** ImportProductSetsRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig|null); - } - - /** Represents an ImportProductSetsRequest. */ - class ImportProductSetsRequest implements IImportProductSetsRequest { - - /** - * Constructs a new ImportProductSetsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImportProductSetsRequest); - - /** ImportProductSetsRequest parent. */ - public parent: string; - - /** ImportProductSetsRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig|null); - - /** - * Creates a new ImportProductSetsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsRequest instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImportProductSetsRequest): google.cloud.vision.v1p3beta1.ImportProductSetsRequest; - - /** - * Encodes the specified ImportProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsRequest.verify|verify} messages. - * @param message ImportProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IImportProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsRequest.verify|verify} messages. - * @param message ImportProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IImportProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsRequest - * @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.ImportProductSetsRequest; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsRequest - * @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.ImportProductSetsRequest; - - /** - * Verifies an ImportProductSetsRequest 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 ImportProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ImportProductSetsRequest; - - /** - * Creates a plain object from an ImportProductSetsRequest message. Also converts values to other types if specified. - * @param message ImportProductSetsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ImportProductSetsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsResponse. */ - interface IImportProductSetsResponse { - - /** ImportProductSetsResponse referenceImages */ - referenceImages?: (google.cloud.vision.v1p3beta1.IReferenceImage[]|null); - - /** ImportProductSetsResponse statuses */ - statuses?: (google.rpc.IStatus[]|null); - } - - /** Represents an ImportProductSetsResponse. */ - class ImportProductSetsResponse implements IImportProductSetsResponse { - - /** - * Constructs a new ImportProductSetsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IImportProductSetsResponse); - - /** ImportProductSetsResponse referenceImages. */ - public referenceImages: google.cloud.vision.v1p3beta1.IReferenceImage[]; - - /** ImportProductSetsResponse statuses. */ - public statuses: google.rpc.IStatus[]; - - /** - * Creates a new ImportProductSetsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsResponse instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IImportProductSetsResponse): google.cloud.vision.v1p3beta1.ImportProductSetsResponse; - - /** - * Encodes the specified ImportProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsResponse.verify|verify} messages. - * @param message ImportProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IImportProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsResponse.verify|verify} messages. - * @param message ImportProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IImportProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsResponse - * @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.ImportProductSetsResponse; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsResponse - * @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.ImportProductSetsResponse; - - /** - * Verifies an ImportProductSetsResponse 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 ImportProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.ImportProductSetsResponse; - - /** - * Creates a plain object from an ImportProductSetsResponse message. Also converts values to other types if specified. - * @param message ImportProductSetsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.ImportProductSetsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchOperationMetadata. */ - interface IBatchOperationMetadata { - - /** BatchOperationMetadata state */ - state?: (google.cloud.vision.v1p3beta1.BatchOperationMetadata.State|keyof typeof google.cloud.vision.v1p3beta1.BatchOperationMetadata.State|null); - - /** BatchOperationMetadata submitTime */ - submitTime?: (google.protobuf.ITimestamp|null); - - /** BatchOperationMetadata endTime */ - endTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a BatchOperationMetadata. */ - class BatchOperationMetadata implements IBatchOperationMetadata { - - /** - * Constructs a new BatchOperationMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IBatchOperationMetadata); - - /** BatchOperationMetadata state. */ - public state: (google.cloud.vision.v1p3beta1.BatchOperationMetadata.State|keyof typeof google.cloud.vision.v1p3beta1.BatchOperationMetadata.State); - - /** BatchOperationMetadata submitTime. */ - public submitTime?: (google.protobuf.ITimestamp|null); - - /** BatchOperationMetadata endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new BatchOperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchOperationMetadata instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IBatchOperationMetadata): google.cloud.vision.v1p3beta1.BatchOperationMetadata; - - /** - * Encodes the specified BatchOperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchOperationMetadata.verify|verify} messages. - * @param message BatchOperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IBatchOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchOperationMetadata.verify|verify} messages. - * @param message BatchOperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IBatchOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BatchOperationMetadata - * @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.BatchOperationMetadata; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BatchOperationMetadata - * @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.BatchOperationMetadata; - - /** - * Verifies a BatchOperationMetadata 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 BatchOperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchOperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.BatchOperationMetadata; - - /** - * Creates a plain object from a BatchOperationMetadata message. Also converts values to other types if specified. - * @param message BatchOperationMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.BatchOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchOperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchOperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BatchOperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - PROCESSING = 1, - SUCCESSFUL = 2, - FAILED = 3, - CANCELLED = 4 - } - } - - /** Properties of a TextAnnotation. */ - interface ITextAnnotation { - - /** TextAnnotation pages */ - pages?: (google.cloud.vision.v1p3beta1.IPage[]|null); - - /** TextAnnotation text */ - text?: (string|null); - } - - /** Represents a TextAnnotation. */ - class TextAnnotation implements ITextAnnotation { - - /** - * Constructs a new TextAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ITextAnnotation); - - /** TextAnnotation pages. */ - public pages: google.cloud.vision.v1p3beta1.IPage[]; - - /** TextAnnotation text. */ - public text: string; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns TextAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ITextAnnotation): google.cloud.vision.v1p3beta1.TextAnnotation; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Verifies a TextAnnotation 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 TextAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.TextAnnotation; - - /** - * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. - * @param message TextAnnotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.TextAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace TextAnnotation { - - /** Properties of a DetectedLanguage. */ - interface IDetectedLanguage { - - /** DetectedLanguage languageCode */ - languageCode?: (string|null); - - /** DetectedLanguage confidence */ - confidence?: (number|null); - } - - /** Represents a DetectedLanguage. */ - class DetectedLanguage implements IDetectedLanguage { - - /** - * Constructs a new DetectedLanguage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedLanguage); - - /** DetectedLanguage languageCode. */ - public languageCode: string; - - /** DetectedLanguage confidence. */ - public confidence: number; - - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedLanguage instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedLanguage): google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage; - - /** - * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Verifies a DetectedLanguage 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 DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedLanguage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @param message DetectedLanguage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedLanguage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedLanguage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DetectedBreak. */ - interface IDetectedBreak { - - /** DetectedBreak type */ - type?: (google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.BreakType|null); - - /** DetectedBreak isPrefix */ - isPrefix?: (boolean|null); - } - - /** Represents a DetectedBreak. */ - class DetectedBreak implements IDetectedBreak { - - /** - * Constructs a new DetectedBreak. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak); - - /** DetectedBreak type. */ - public type: (google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.BreakType); - - /** DetectedBreak isPrefix. */ - public isPrefix: boolean; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedBreak instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak): google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Verifies a DetectedBreak 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 DetectedBreak message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedBreak - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak; - - /** - * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. - * @param message DetectedBreak - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedBreak to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedBreak - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DetectedBreak { - - /** BreakType enum. */ - enum BreakType { - UNKNOWN = 0, - SPACE = 1, - SURE_SPACE = 2, - EOL_SURE_SPACE = 3, - HYPHEN = 4, - LINE_BREAK = 5 - } - } - - /** Properties of a TextProperty. */ - interface ITextProperty { - - /** TextProperty detectedLanguages */ - detectedLanguages?: (google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedLanguage[]|null); - - /** TextProperty detectedBreak */ - detectedBreak?: (google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak|null); - } - - /** Represents a TextProperty. */ - class TextProperty implements ITextProperty { - - /** - * Constructs a new TextProperty. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty); - - /** TextProperty detectedLanguages. */ - public detectedLanguages: google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedLanguage[]; - - /** TextProperty detectedBreak. */ - public detectedBreak?: (google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak|null); - - /** - * Creates a new TextProperty instance using the specified properties. - * @param [properties] Properties to set - * @returns TextProperty instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty): google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty; - - /** - * Encodes the specified TextProperty message. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextProperty message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextProperty message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Decodes a TextProperty message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Verifies a TextProperty 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 TextProperty message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextProperty - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty; - - /** - * Creates a plain object from a TextProperty message. Also converts values to other types if specified. - * @param message TextProperty - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextProperty to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextProperty - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a Page. */ - interface IPage { - - /** Page property */ - property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Page width */ - width?: (number|null); - - /** Page height */ - height?: (number|null); - - /** Page blocks */ - blocks?: (google.cloud.vision.v1p3beta1.IBlock[]|null); - - /** Page confidence */ - confidence?: (number|null); - } - - /** Represents a Page. */ - class Page implements IPage { - - /** - * Constructs a new Page. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IPage); - - /** Page property. */ - public property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Page width. */ - public width: number; - - /** Page height. */ - public height: number; - - /** Page blocks. */ - public blocks: google.cloud.vision.v1p3beta1.IBlock[]; - - /** Page confidence. */ - public confidence: number; - - /** - * Creates a new Page instance using the specified properties. - * @param [properties] Properties to set - * @returns Page instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IPage): google.cloud.vision.v1p3beta1.Page; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Page message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Page - * @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.Page; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Page - * @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.Page; - - /** - * Verifies a Page 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 Page message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Page - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Page; - - /** - * Creates a plain object from a Page message. Also converts values to other types if specified. - * @param message Page - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Page to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Page - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Block. */ - interface IBlock { - - /** Block property */ - property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox */ - boundingBox?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** Block paragraphs */ - paragraphs?: (google.cloud.vision.v1p3beta1.IParagraph[]|null); - - /** Block blockType */ - blockType?: (google.cloud.vision.v1p3beta1.Block.BlockType|keyof typeof google.cloud.vision.v1p3beta1.Block.BlockType|null); - - /** Block confidence */ - confidence?: (number|null); - } - - /** Represents a Block. */ - class Block implements IBlock { - - /** - * Constructs a new Block. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IBlock); - - /** Block property. */ - public property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** Block paragraphs. */ - public paragraphs: google.cloud.vision.v1p3beta1.IParagraph[]; - - /** Block blockType. */ - public blockType: (google.cloud.vision.v1p3beta1.Block.BlockType|keyof typeof google.cloud.vision.v1p3beta1.Block.BlockType); - - /** Block confidence. */ - public confidence: number; - - /** - * Creates a new Block instance using the specified properties. - * @param [properties] Properties to set - * @returns Block instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IBlock): google.cloud.vision.v1p3beta1.Block; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Block message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Block - * @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.Block; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Block - * @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.Block; - - /** - * Verifies a Block 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 Block message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Block - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Block; - - /** - * Creates a plain object from a Block message. Also converts values to other types if specified. - * @param message Block - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Block to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Block - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Block { - - /** BlockType enum. */ - enum BlockType { - UNKNOWN = 0, - TEXT = 1, - TABLE = 2, - PICTURE = 3, - RULER = 4, - BARCODE = 5 - } - } - - /** Properties of a Paragraph. */ - interface IParagraph { - - /** Paragraph property */ - property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox */ - boundingBox?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** Paragraph words */ - words?: (google.cloud.vision.v1p3beta1.IWord[]|null); - - /** Paragraph confidence */ - confidence?: (number|null); - } - - /** Represents a Paragraph. */ - class Paragraph implements IParagraph { - - /** - * Constructs a new Paragraph. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IParagraph); - - /** Paragraph property. */ - public property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** Paragraph words. */ - public words: google.cloud.vision.v1p3beta1.IWord[]; - - /** Paragraph confidence. */ - public confidence: number; - - /** - * Creates a new Paragraph instance using the specified properties. - * @param [properties] Properties to set - * @returns Paragraph instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IParagraph): google.cloud.vision.v1p3beta1.Paragraph; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Paragraph message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Paragraph - * @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.Paragraph; - - /** - * Decodes a Paragraph message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Paragraph - * @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.Paragraph; - - /** - * Verifies a Paragraph 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 Paragraph message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Paragraph - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Paragraph; - - /** - * Creates a plain object from a Paragraph message. Also converts values to other types if specified. - * @param message Paragraph - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Paragraph to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Paragraph - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Word. */ - interface IWord { - - /** Word property */ - property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox */ - boundingBox?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** Word symbols */ - symbols?: (google.cloud.vision.v1p3beta1.ISymbol[]|null); - - /** Word confidence */ - confidence?: (number|null); - } - - /** Represents a Word. */ - class Word implements IWord { - - /** - * Constructs a new Word. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IWord); - - /** Word property. */ - public property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** Word symbols. */ - public symbols: google.cloud.vision.v1p3beta1.ISymbol[]; - - /** Word confidence. */ - public confidence: number; - - /** - * Creates a new Word instance using the specified properties. - * @param [properties] Properties to set - * @returns Word instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IWord): google.cloud.vision.v1p3beta1.Word; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Word message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Word message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Word - * @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.Word; - - /** - * Decodes a Word message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Word - * @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.Word; - - /** - * Verifies a Word 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 Word message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Word - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Word; - - /** - * Creates a plain object from a Word message. Also converts values to other types if specified. - * @param message Word - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Word, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Word to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Word - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Symbol. */ - interface ISymbol { - - /** Symbol property */ - property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox */ - boundingBox?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** Symbol text */ - text?: (string|null); - - /** Symbol confidence */ - confidence?: (number|null); - } - - /** Represents a Symbol. */ - class Symbol implements ISymbol { - - /** - * Constructs a new Symbol. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.ISymbol); - - /** Symbol property. */ - public property?: (google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p3beta1.IBoundingPoly|null); - - /** Symbol text. */ - public text: string; - - /** Symbol confidence. */ - public confidence: number; - - /** - * Creates a new Symbol instance using the specified properties. - * @param [properties] Properties to set - * @returns Symbol instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.ISymbol): google.cloud.vision.v1p3beta1.Symbol; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Symbol message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p3beta1.Symbol; - - /** - * Decodes a Symbol message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p3beta1.Symbol; - - /** - * Verifies a Symbol message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Symbol message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Symbol - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Symbol; - - /** - * Creates a plain object from a Symbol message. Also converts values to other types if specified. - * @param message Symbol - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Symbol to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Symbol - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetection. */ - interface IWebDetection { - - /** WebDetection webEntities */ - webEntities?: (google.cloud.vision.v1p3beta1.WebDetection.IWebEntity[]|null); - - /** WebDetection fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]|null); - - /** WebDetection partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]|null); - - /** WebDetection pagesWithMatchingImages */ - pagesWithMatchingImages?: (google.cloud.vision.v1p3beta1.WebDetection.IWebPage[]|null); - - /** WebDetection visuallySimilarImages */ - visuallySimilarImages?: (google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]|null); - - /** WebDetection bestGuessLabels */ - bestGuessLabels?: (google.cloud.vision.v1p3beta1.WebDetection.IWebLabel[]|null); - } - - /** Represents a WebDetection. */ - class WebDetection implements IWebDetection { - - /** - * Constructs a new WebDetection. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IWebDetection); - - /** WebDetection webEntities. */ - public webEntities: google.cloud.vision.v1p3beta1.WebDetection.IWebEntity[]; - - /** WebDetection fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]; - - /** WebDetection partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]; - - /** WebDetection pagesWithMatchingImages. */ - public pagesWithMatchingImages: google.cloud.vision.v1p3beta1.WebDetection.IWebPage[]; - - /** WebDetection visuallySimilarImages. */ - public visuallySimilarImages: google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]; - - /** WebDetection bestGuessLabels. */ - public bestGuessLabels: google.cloud.vision.v1p3beta1.WebDetection.IWebLabel[]; - - /** - * Creates a new WebDetection instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetection instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IWebDetection): google.cloud.vision.v1p3beta1.WebDetection; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetection message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebDetection message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebDetection - * @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.WebDetection; - - /** - * Decodes a WebDetection message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebDetection - * @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.WebDetection; - - /** - * Verifies a WebDetection 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 WebDetection message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetection - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.WebDetection; - - /** - * Creates a plain object from a WebDetection message. Also converts values to other types if specified. - * @param message WebDetection - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.WebDetection, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetection to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetection - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace WebDetection { - - /** Properties of a WebEntity. */ - interface IWebEntity { - - /** WebEntity entityId */ - entityId?: (string|null); - - /** WebEntity score */ - score?: (number|null); - - /** WebEntity description */ - description?: (string|null); - } - - /** Represents a WebEntity. */ - class WebEntity implements IWebEntity { - - /** - * Constructs a new WebEntity. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.WebDetection.IWebEntity); - - /** WebEntity entityId. */ - public entityId: string; - - /** WebEntity score. */ - public score: number; - - /** WebEntity description. */ - public description: string; - - /** - * Creates a new WebEntity instance using the specified properties. - * @param [properties] Properties to set - * @returns WebEntity instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.WebDetection.IWebEntity): google.cloud.vision.v1p3beta1.WebDetection.WebEntity; - - /** - * Encodes the specified WebEntity message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Verifies a WebEntity 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 WebEntity message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebEntity - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.WebDetection.WebEntity; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @param message WebEntity - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.WebDetection.WebEntity, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebEntity to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebEntity - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebImage. */ - interface IWebImage { - - /** WebImage url */ - url?: (string|null); - - /** WebImage score */ - score?: (number|null); - } - - /** Represents a WebImage. */ - class WebImage implements IWebImage { - - /** - * Constructs a new WebImage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.WebDetection.IWebImage); - - /** WebImage url. */ - public url: string; - - /** WebImage score. */ - public score: number; - - /** - * Creates a new WebImage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebImage instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.WebDetection.IWebImage): google.cloud.vision.v1p3beta1.WebDetection.WebImage; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Verifies a WebImage 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 WebImage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebImage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.WebDetection.WebImage; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @param message WebImage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.WebDetection.WebImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebImage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebImage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebPage. */ - interface IWebPage { - - /** WebPage url */ - url?: (string|null); - - /** WebPage score */ - score?: (number|null); - - /** WebPage pageTitle */ - pageTitle?: (string|null); - - /** WebPage fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]|null); - - /** WebPage partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]|null); - } - - /** Represents a WebPage. */ - class WebPage implements IWebPage { - - /** - * Constructs a new WebPage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.WebDetection.IWebPage); - - /** WebPage url. */ - public url: string; - - /** WebPage score. */ - public score: number; - - /** WebPage pageTitle. */ - public pageTitle: string; - - /** WebPage fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]; - - /** WebPage partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1p3beta1.WebDetection.IWebImage[]; - - /** - * Creates a new WebPage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebPage instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.WebDetection.IWebPage): google.cloud.vision.v1p3beta1.WebDetection.WebPage; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Verifies a WebPage 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 WebPage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebPage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.WebDetection.WebPage; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @param message WebPage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.WebDetection.WebPage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebPage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebPage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebLabel. */ - interface IWebLabel { - - /** WebLabel label */ - label?: (string|null); - - /** WebLabel languageCode */ - languageCode?: (string|null); - } - - /** Represents a WebLabel. */ - class WebLabel implements IWebLabel { - - /** - * Constructs a new WebLabel. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.WebDetection.IWebLabel); - - /** WebLabel label. */ - public label: string; - - /** WebLabel languageCode. */ - public languageCode: string; - - /** - * Creates a new WebLabel instance using the specified properties. - * @param [properties] Properties to set - * @returns WebLabel instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.WebDetection.IWebLabel): google.cloud.vision.v1p3beta1.WebDetection.WebLabel; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Verifies a WebLabel 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 WebLabel message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebLabel - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.WebDetection.WebLabel; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @param message WebLabel - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.WebDetection.WebLabel, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebLabel to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebLabel - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - - /** Namespace v1p4beta1. */ - namespace v1p4beta1 { - - /** Properties of a FaceRecognitionParams. */ - interface IFaceRecognitionParams { - - /** FaceRecognitionParams celebritySet */ - celebritySet?: (string[]|null); - } - - /** Represents a FaceRecognitionParams. */ - class FaceRecognitionParams implements IFaceRecognitionParams { - - /** - * Constructs a new FaceRecognitionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionParams); - - /** FaceRecognitionParams celebritySet. */ - public celebritySet: string[]; - - /** - * Creates a new FaceRecognitionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns FaceRecognitionParams instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionParams): google.cloud.vision.v1p4beta1.FaceRecognitionParams; - - /** - * 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 static encode(message: google.cloud.vision.v1p4beta1.IFaceRecognitionParams, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceRecognitionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.FaceRecognitionParams; - - /** - * 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 static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.FaceRecognitionParams; - - /** - * Verifies a FaceRecognitionParams 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. - * @param object Plain object - * @returns FaceRecognitionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceRecognitionParams; - - /** - * 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 - */ - public static toObject(message: google.cloud.vision.v1p4beta1.FaceRecognitionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FaceRecognitionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FaceRecognitionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Celebrity. */ - interface ICelebrity { - - /** Celebrity name */ - name?: (string|null); - - /** Celebrity displayName */ - displayName?: (string|null); - - /** Celebrity description */ - description?: (string|null); - } - - /** Represents a Celebrity. */ - class Celebrity implements ICelebrity { - - /** - * Constructs a new Celebrity. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICelebrity); - - /** Celebrity name. */ - public name: string; - - /** Celebrity displayName. */ - public displayName: string; - - /** Celebrity description. */ - public description: string; - - /** - * Creates a new Celebrity instance using the specified properties. - * @param [properties] Properties to set - * @returns Celebrity instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICelebrity): google.cloud.vision.v1p4beta1.Celebrity; - - /** - * 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.ICelebrity, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICelebrity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.Celebrity; - - /** - * Decodes a Celebrity message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.Celebrity; - - /** - * 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 Celebrity message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Celebrity - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Celebrity; - - /** - * 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.Celebrity, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Celebrity to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Celebrity - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FaceRecognitionResult. */ - interface IFaceRecognitionResult { - - /** FaceRecognitionResult celebrity */ - celebrity?: (google.cloud.vision.v1p4beta1.ICelebrity|null); - - /** FaceRecognitionResult confidence */ - confidence?: (number|null); - } - - /** Represents a FaceRecognitionResult. */ - class FaceRecognitionResult implements IFaceRecognitionResult { - - /** - * Constructs a new FaceRecognitionResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionResult); - - /** FaceRecognitionResult celebrity. */ - public celebrity?: (google.cloud.vision.v1p4beta1.ICelebrity|null); - - /** FaceRecognitionResult confidence. */ - public confidence: number; - - /** - * Creates a new FaceRecognitionResult instance using the specified properties. - * @param [properties] Properties to set - * @returns FaceRecognitionResult instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionResult): google.cloud.vision.v1p4beta1.FaceRecognitionResult; - - /** - * 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.IFaceRecognitionResult, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.FaceRecognitionResult; - - /** - * Decodes a FaceRecognitionResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.FaceRecognitionResult; - - /** - * 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 a FaceRecognitionResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FaceRecognitionResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceRecognitionResult; - - /** - * 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.FaceRecognitionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FaceRecognitionResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FaceRecognitionResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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.v1p4beta1.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.v1p4beta1.IVertex): google.cloud.vision.v1p4beta1.Vertex; - - /** - * 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.IVertex, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Vertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Vertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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.v1p4beta1.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.v1p4beta1.INormalizedVertex): google.cloud.vision.v1p4beta1.NormalizedVertex; - - /** - * 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.INormalizedVertex, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NormalizedVertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for NormalizedVertex - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BoundingPoly. */ - interface IBoundingPoly { - - /** BoundingPoly vertices */ - vertices?: (google.cloud.vision.v1p4beta1.IVertex[]|null); - - /** BoundingPoly normalizedVertices */ - normalizedVertices?: (google.cloud.vision.v1p4beta1.INormalizedVertex[]|null); - } - - /** Represents a BoundingPoly. */ - class BoundingPoly implements IBoundingPoly { - - /** - * Constructs a new BoundingPoly. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBoundingPoly); - - /** BoundingPoly vertices. */ - public vertices: google.cloud.vision.v1p4beta1.IVertex[]; - - /** BoundingPoly normalizedVertices. */ - public normalizedVertices: google.cloud.vision.v1p4beta1.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.v1p4beta1.IBoundingPoly): google.cloud.vision.v1p4beta1.BoundingPoly; - - /** - * 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.IBoundingPoly, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BoundingPoly to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BoundingPoly - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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.v1p4beta1.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.v1p4beta1.IPosition): google.cloud.vision.v1p4beta1.Position; - - /** - * 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.IPosition, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Position to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Position - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** - * 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; - - /** - * 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; - - /** - * Calls BatchAnnotateImages. - * @param request BatchAnnotateImagesRequest message or plain object - * @returns Promise - */ - public batchAnnotateImages(request: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest): Promise; - - /** - * 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; - - /** - * Calls BatchAnnotateFiles. - * @param request BatchAnnotateFilesRequest message or plain object - * @returns Promise - */ - public batchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest): Promise; - - /** - * Calls AsyncBatchAnnotateImages. - * @param request AsyncBatchAnnotateImagesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public asyncBatchAnnotateImages(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImagesCallback): void; - - /** - * Calls AsyncBatchAnnotateImages. - * @param request AsyncBatchAnnotateImagesRequest message or plain object - * @returns Promise - */ - public asyncBatchAnnotateImages(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest): Promise; - - /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback): void; - - /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @returns Promise - */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest): Promise; - } - - namespace ImageAnnotator { - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator|batchAnnotateImages}. - * @param error Error, if any - * @param [response] BatchAnnotateImagesResponse - */ - type BatchAnnotateImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator|batchAnnotateFiles}. - * @param error Error, if any - * @param [response] BatchAnnotateFilesResponse - */ - type BatchAnnotateFilesCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator|asyncBatchAnnotateImages}. - * @param error Error, if any - * @param [response] Operation - */ - type AsyncBatchAnnotateImagesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator|asyncBatchAnnotateFiles}. - * @param error Error, if any - * @param [response] Operation - */ - type AsyncBatchAnnotateFilesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a Feature. */ - interface IFeature { - - /** Feature type */ - type?: (google.cloud.vision.v1p4beta1.Feature.Type|keyof typeof google.cloud.vision.v1p4beta1.Feature.Type|null); - - /** Feature maxResults */ - maxResults?: (number|null); - - /** Feature model */ - model?: (string|null); - } - - /** Represents a Feature. */ - class Feature implements IFeature { - - /** - * Constructs a new Feature. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IFeature); - - /** Feature type. */ - public type: (google.cloud.vision.v1p4beta1.Feature.Type|keyof typeof google.cloud.vision.v1p4beta1.Feature.Type); - - /** Feature maxResults. */ - public maxResults: number; - - /** Feature model. */ - public model: string; - - /** - * Creates a new Feature instance using the specified properties. - * @param [properties] Properties to set - * @returns Feature instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IFeature): google.cloud.vision.v1p4beta1.Feature; - - /** - * 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.IFeature, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.Feature; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.Feature; - - /** - * 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 Feature message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Feature - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Feature; - - /** - * 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.Feature, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Feature to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Feature - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 { - - /** ImageSource gcsImageUri */ - gcsImageUri?: (string|null); - - /** ImageSource imageUri */ - imageUri?: (string|null); - } - - /** Represents an ImageSource. */ - class ImageSource implements IImageSource { - - /** - * Constructs a new ImageSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImageSource); - - /** ImageSource gcsImageUri. */ - public gcsImageUri: string; - - /** ImageSource imageUri. */ - public imageUri: string; - - /** - * Creates a new ImageSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageSource instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImageSource): google.cloud.vision.v1p4beta1.ImageSource; - - /** - * 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.IImageSource, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.ImageSource; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.ImageSource; - - /** - * 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 an ImageSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageSource; - - /** - * 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.ImageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Image. */ - interface IImage { - - /** Image content */ - content?: (Uint8Array|string|null); - - /** Image source */ - source?: (google.cloud.vision.v1p4beta1.IImageSource|null); - } - - /** Represents an Image. */ - class Image implements IImage { - - /** - * Constructs a new Image. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImage); - - /** Image content. */ - public content: (Uint8Array|string); - - /** Image source. */ - public source?: (google.cloud.vision.v1p4beta1.IImageSource|null); - - /** - * Creates a new Image instance using the specified properties. - * @param [properties] Properties to set - * @returns Image instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImage): google.cloud.vision.v1p4beta1.Image; - - /** - * 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.IImage, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.Image; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.Image; - - /** - * 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 an Image message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Image - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Image; - - /** - * 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.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Image to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Image - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** 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 FaceAnnotation. */ - class FaceAnnotation implements IFaceAnnotation { - - /** - * Constructs a new FaceAnnotation. - * @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); - - /** FaceAnnotation headwearLikelihood. */ - public headwearLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - - /** FaceAnnotation recognitionResult. */ - public recognitionResult: google.cloud.vision.v1p4beta1.IFaceRecognitionResult[]; - - /** - * Creates a new FaceAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns FaceAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IFaceAnnotation): google.cloud.vision.v1p4beta1.FaceAnnotation; - - /** - * 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.IFaceAnnotation, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.FaceAnnotation; - - /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.FaceAnnotation; - - /** - * 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 FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FaceAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceAnnotation; - - /** - * 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.FaceAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FaceAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FaceAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 }; - - /** - * Gets the default type url for Landmark - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - 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 LocationInfo. */ - interface ILocationInfo { - - /** LocationInfo latLng */ - latLng?: (google.type.ILatLng|null); - } - - /** Represents a LocationInfo. */ - class LocationInfo implements ILocationInfo { - - /** - * Constructs a new LocationInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ILocationInfo); - - /** LocationInfo latLng. */ - public latLng?: (google.type.ILatLng|null); - - /** - * Creates a new LocationInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns LocationInfo instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ILocationInfo): google.cloud.vision.v1p4beta1.LocationInfo; - - /** - * 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.ILocationInfo, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LocationInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.LocationInfo; - - /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.LocationInfo; - - /** - * Verifies a LocationInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocationInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LocationInfo; - - /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @param message LocationInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocationInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocationInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Property. */ - interface IProperty { - - /** Property name */ - name?: (string|null); - - /** Property value */ - value?: (string|null); - - /** Property uint64Value */ - uint64Value?: (number|Long|string|null); - } - - /** Represents a Property. */ - class Property implements IProperty { - - /** - * Constructs a new Property. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IProperty); - - /** Property name. */ - public name: string; - - /** Property value. */ - public value: string; - - /** Property uint64Value. */ - public uint64Value: (number|Long|string); - - /** - * Creates a new Property instance using the specified properties. - * @param [properties] Properties to set - * @returns Property instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IProperty): google.cloud.vision.v1p4beta1.Property; - - /** - * 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.IProperty, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Property message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.Property; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.Property; - - /** - * Verifies a Property message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Property - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Property; - - /** - * 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.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Property to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Property - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 { - - /** - * Constructs a new EntityAnnotation. - * @param [properties] Properties to set - */ - 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; - - /** 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 EntityAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns EntityAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IEntityAnnotation): google.cloud.vision.v1p4beta1.EntityAnnotation; - - /** - * 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.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.EntityAnnotation; - - /** - * 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 - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.EntityAnnotation; - - /** - * 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 an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EntityAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.EntityAnnotation; - - /** - * 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.EntityAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EntityAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EntityAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LocalizedObjectAnnotation. */ - interface ILocalizedObjectAnnotation { - - /** 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 LocalizedObjectAnnotation. */ - class LocalizedObjectAnnotation implements ILocalizedObjectAnnotation { - - /** - * Constructs a new LocalizedObjectAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation); - - /** 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 LocalizedObjectAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns LocalizedObjectAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation): google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation; - - /** - * 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.ILocalizedObjectAnnotation, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.LocalizedObjectAnnotation; - - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.LocalizedObjectAnnotation; - - /** - * 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 LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocalizedObjectAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation; - - /** - * 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.LocalizedObjectAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocalizedObjectAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocalizedObjectAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SafeSearchAnnotation. */ - interface ISafeSearchAnnotation { - - /** 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 SafeSearchAnnotation. */ - class SafeSearchAnnotation implements ISafeSearchAnnotation { - - /** - * Constructs a new SafeSearchAnnotation. - * @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); - - /** 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 SafeSearchAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns SafeSearchAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation): google.cloud.vision.v1p4beta1.SafeSearchAnnotation; - - /** - * 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.ISafeSearchAnnotation, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.SafeSearchAnnotation; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.SafeSearchAnnotation; - - /** - * 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 SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SafeSearchAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.SafeSearchAnnotation; - - /** - * 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.SafeSearchAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LatLongRect. */ - interface ILatLongRect { - - /** LatLongRect minLatLng */ - minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng */ - maxLatLng?: (google.type.ILatLng|null); - } - - /** Represents a LatLongRect. */ - class LatLongRect implements ILatLongRect { - - /** - * Constructs a new LatLongRect. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ILatLongRect); - - /** LatLongRect minLatLng. */ - public minLatLng?: (google.type.ILatLng|null); - - /** LatLongRect maxLatLng. */ - public maxLatLng?: (google.type.ILatLng|null); - - /** - * Creates a new LatLongRect instance using the specified properties. - * @param [properties] Properties to set - * @returns LatLongRect instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ILatLongRect): google.cloud.vision.v1p4beta1.LatLongRect; - - /** - * 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.ILatLongRect, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.LatLongRect; - - /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.LatLongRect; - - /** - * 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 LatLongRect message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LatLongRect - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LatLongRect; - - /** - * 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.LatLongRect, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LatLongRect to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LatLongRect - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ColorInfo. */ - interface IColorInfo { - - /** ColorInfo color */ - color?: (google.type.IColor|null); - - /** ColorInfo score */ - score?: (number|null); - - /** ColorInfo pixelFraction */ - pixelFraction?: (number|null); - } - - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { - - /** - * Constructs a new ColorInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IColorInfo); - - /** ColorInfo color. */ - public color?: (google.type.IColor|null); - - /** ColorInfo score. */ - public score: number; - - /** ColorInfo pixelFraction. */ - public pixelFraction: number; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns ColorInfo instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IColorInfo): google.cloud.vision.v1p4beta1.ColorInfo; - - /** - * 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.IColorInfo, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.ColorInfo; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.ColorInfo; - - /** - * 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 a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ColorInfo - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ColorInfo; - - /** - * 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.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ColorInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ColorInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DominantColorsAnnotation. */ - interface IDominantColorsAnnotation { - - /** DominantColorsAnnotation colors */ - colors?: (google.cloud.vision.v1p4beta1.IColorInfo[]|null); - } - - /** Represents a DominantColorsAnnotation. */ - class DominantColorsAnnotation implements IDominantColorsAnnotation { - - /** - * Constructs a new DominantColorsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation); - - /** DominantColorsAnnotation colors. */ - public colors: google.cloud.vision.v1p4beta1.IColorInfo[]; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns DominantColorsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; - - /** - * 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.IDominantColorsAnnotation, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.DominantColorsAnnotation; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.DominantColorsAnnotation; - - /** - * 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 a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DominantColorsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; - - /** - * 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.DominantColorsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageProperties. */ - interface IImageProperties { - - /** ImageProperties dominantColors */ - dominantColors?: (google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null); - } - - /** Represents an ImageProperties. */ - class ImageProperties implements IImageProperties { - - /** - * Constructs a new ImageProperties. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImageProperties); - - /** ImageProperties dominantColors. */ - public dominantColors?: (google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null); - - /** - * Creates a new ImageProperties instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageProperties instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImageProperties): google.cloud.vision.v1p4beta1.ImageProperties; - - /** - * 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.IImageProperties, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 ImageProperties - * @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; - - /** - * 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; - - /** - * Verifies an ImageProperties 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. - * @param object Plain object - * @returns ImageProperties - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageProperties; - - /** - * 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 }; - - /** - * Converts this ImageProperties to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageProperties - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHint. */ - interface ICropHint { - - /** CropHint boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** CropHint confidence */ - confidence?: (number|null); - - /** CropHint importanceFraction */ - importanceFraction?: (number|null); - } - - /** Represents a CropHint. */ - class CropHint implements ICropHint { - - /** - * Constructs a new CropHint. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICropHint); - - /** CropHint boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** CropHint confidence. */ - public confidence: number; - - /** CropHint importanceFraction. */ - public importanceFraction: number; - - /** - * Creates a new CropHint instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHint instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICropHint): google.cloud.vision.v1p4beta1.CropHint; - - /** - * 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.ICropHint, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.CropHint; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.CropHint; - - /** - * 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 a CropHint message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHint - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHint; - - /** - * 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.CropHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHint to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHint - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsAnnotation. */ - interface ICropHintsAnnotation { - - /** CropHintsAnnotation cropHints */ - cropHints?: (google.cloud.vision.v1p4beta1.ICropHint[]|null); - } - - /** Represents a CropHintsAnnotation. */ - class CropHintsAnnotation implements ICropHintsAnnotation { - - /** - * Constructs a new CropHintsAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICropHintsAnnotation); - - /** CropHintsAnnotation cropHints. */ - public cropHints: google.cloud.vision.v1p4beta1.ICropHint[]; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICropHintsAnnotation): google.cloud.vision.v1p4beta1.CropHintsAnnotation; - - /** - * 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.ICropHintsAnnotation, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.CropHintsAnnotation; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.CropHintsAnnotation; - - /** - * 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 CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHintsAnnotation; - - /** - * 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.CropHintsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CropHintsParams. */ - interface ICropHintsParams { - - /** CropHintsParams aspectRatios */ - aspectRatios?: (number[]|null); - } - - /** Represents a CropHintsParams. */ - class CropHintsParams implements ICropHintsParams { - - /** - * Constructs a new CropHintsParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICropHintsParams); - - /** CropHintsParams aspectRatios. */ - public aspectRatios: number[]; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @param [properties] Properties to set - * @returns CropHintsParams instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICropHintsParams): google.cloud.vision.v1p4beta1.CropHintsParams; - - /** - * 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.ICropHintsParams, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.CropHintsParams; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.CropHintsParams; - - /** - * 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 CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CropHintsParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHintsParams; - - /** - * 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.CropHintsParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CropHintsParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CropHintsParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetectionParams. */ - interface IWebDetectionParams { - - /** WebDetectionParams includeGeoResults */ - includeGeoResults?: (boolean|null); - } - - /** Represents a WebDetectionParams. */ - class WebDetectionParams implements IWebDetectionParams { - - /** - * Constructs a new WebDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IWebDetectionParams); - - /** WebDetectionParams includeGeoResults. */ - public includeGeoResults: boolean; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IWebDetectionParams): google.cloud.vision.v1p4beta1.WebDetectionParams; - - /** - * 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.IWebDetectionParams, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.WebDetectionParams; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.WebDetectionParams; - - /** - * 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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.WebDetectionParams; - - /** - * 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.WebDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TextDetectionParams. */ - interface ITextDetectionParams { - - /** TextDetectionParams enableTextDetectionConfidenceScore */ - enableTextDetectionConfidenceScore?: (boolean|null); - - /** TextDetectionParams advancedOcrOptions */ - advancedOcrOptions?: (string[]|null); - } - - /** Represents a TextDetectionParams. */ - class TextDetectionParams implements ITextDetectionParams { - - /** - * Constructs a new TextDetectionParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ITextDetectionParams); - - /** TextDetectionParams enableTextDetectionConfidenceScore. */ - public enableTextDetectionConfidenceScore: boolean; - - /** TextDetectionParams advancedOcrOptions. */ - public advancedOcrOptions: string[]; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @param [properties] Properties to set - * @returns TextDetectionParams instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ITextDetectionParams): google.cloud.vision.v1p4beta1.TextDetectionParams; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextDetectionParams.verify|verify} messages. - * @param message TextDetectionParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ITextDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextDetectionParams - * @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.TextDetectionParams; - - /** - * Verifies a TextDetectionParams 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 TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextDetectionParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.TextDetectionParams; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @param message TextDetectionParams - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.TextDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextDetectionParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextDetectionParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** 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); - - /** ImageContext textDetectionParams */ - textDetectionParams?: (google.cloud.vision.v1p4beta1.ITextDetectionParams|null); - } - - /** Represents an ImageContext. */ - class ImageContext implements IImageContext { - - /** - * Constructs a new ImageContext. - * @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); - - /** 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); - - /** ImageContext textDetectionParams. */ - public textDetectionParams?: (google.cloud.vision.v1p4beta1.ITextDetectionParams|null); - - /** - * Creates a new ImageContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageContext instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImageContext): google.cloud.vision.v1p4beta1.ImageContext; - - /** - * 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.IImageContext, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.ImageContext; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.ImageContext; - - /** - * 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 ImageContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageContext; - - /** - * 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.ImageContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImageContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateImageRequest. */ - interface IAnnotateImageRequest { - - /** 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 an AnnotateImageRequest. */ - class AnnotateImageRequest implements IAnnotateImageRequest { - - /** - * Constructs a new AnnotateImageRequest. - * @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[]; - - /** AnnotateImageRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageRequest): google.cloud.vision.v1p4beta1.AnnotateImageRequest; - - /** - * 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.IAnnotateImageRequest, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AnnotateImageRequest; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AnnotateImageRequest; - - /** - * 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 an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateImageRequest; - - /** - * 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.AnnotateImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImageAnnotationContext. */ - interface IImageAnnotationContext { - - /** ImageAnnotationContext uri */ - uri?: (string|null); - - /** ImageAnnotationContext pageNumber */ - pageNumber?: (number|null); - } - - /** Represents an ImageAnnotationContext. */ - class ImageAnnotationContext implements IImageAnnotationContext { - - /** - * Constructs a new ImageAnnotationContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImageAnnotationContext); - - /** ImageAnnotationContext uri. */ - public uri: string; - - /** ImageAnnotationContext pageNumber. */ - public pageNumber: number; - - /** - * Creates a new ImageAnnotationContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImageAnnotationContext instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImageAnnotationContext): google.cloud.vision.v1p4beta1.ImageAnnotationContext; - - /** - * 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.IImageAnnotationContext, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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 - * @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 }; - - /** - * Converts this ImageAnnotationContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImageAnnotationContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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 { - - /** - * Constructs a new AnnotateImageResponse. - * @param [properties] Properties to set - */ - 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[]; - - /** AnnotateImageResponse logoAnnotations. */ - public logoAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; - - /** 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 AnnotateImageResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateImageResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageResponse): google.cloud.vision.v1p4beta1.AnnotateImageResponse; - - /** - * 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.IAnnotateImageResponse, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AnnotateImageResponse; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AnnotateImageResponse; - - /** - * 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 AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateImageResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateImageResponse; - - /** - * 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.AnnotateImageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateImageResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateImageResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesRequest. */ - interface IBatchAnnotateImagesRequest { - - /** BatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]|null); - } - - /** Represents a BatchAnnotateImagesRequest. */ - class BatchAnnotateImagesRequest implements IBatchAnnotateImagesRequest { - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest); - - /** BatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest): google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest; - - /** - * 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.IBatchAnnotateImagesRequest, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.BatchAnnotateImagesRequest; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.BatchAnnotateImagesRequest; - - /** - * 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 a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest; - - /** - * 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.BatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateImagesResponse. */ - interface IBatchAnnotateImagesResponse { - - /** BatchAnnotateImagesResponse responses */ - responses?: (google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]|null); - } - - /** Represents a BatchAnnotateImagesResponse. */ - class BatchAnnotateImagesResponse implements IBatchAnnotateImagesResponse { - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse); - - /** BatchAnnotateImagesResponse responses. */ - public responses: google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse): google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse; - - /** - * 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.IBatchAnnotateImagesResponse, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.BatchAnnotateImagesResponse; - - /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.BatchAnnotateImagesResponse; - - /** - * 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 a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse; - - /** - * 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.BatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** AnnotateFileRequest pages */ - pages?: (number[]|null); - } - - /** Represents an AnnotateFileRequest. */ - class AnnotateFileRequest implements IAnnotateFileRequest { - - /** - * Constructs a new AnnotateFileRequest. - * @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); - - /** AnnotateFileRequest pages. */ - public pages: number[]; - - /** - * Creates a new AnnotateFileRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateFileRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileRequest): google.cloud.vision.v1p4beta1.AnnotateFileRequest; - - /** - * 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.IAnnotateFileRequest, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AnnotateFileRequest; - - /** - * Decodes an AnnotateFileRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AnnotateFileRequest; - - /** - * 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 AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateFileRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateFileRequest; - - /** - * 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.AnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateFileRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateFileRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AnnotateFileResponse. */ - interface IAnnotateFileResponse { - - /** 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 AnnotateFileResponse. */ - class AnnotateFileResponse implements IAnnotateFileResponse { - - /** - * Constructs a new AnnotateFileResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileResponse); - - /** 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 AnnotateFileResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AnnotateFileResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileResponse): google.cloud.vision.v1p4beta1.AnnotateFileResponse; - - /** - * 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.IAnnotateFileResponse, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AnnotateFileResponse; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AnnotateFileResponse; - - /** - * 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 AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AnnotateFileResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateFileResponse; - - /** - * 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.AnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AnnotateFileResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AnnotateFileResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateFilesRequest. */ - interface IBatchAnnotateFilesRequest { - - /** BatchAnnotateFilesRequest requests */ - requests?: (google.cloud.vision.v1p4beta1.IAnnotateFileRequest[]|null); - } - - /** Represents a BatchAnnotateFilesRequest. */ - class BatchAnnotateFilesRequest implements IBatchAnnotateFilesRequest { - - /** - * Constructs a new BatchAnnotateFilesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest); - - /** BatchAnnotateFilesRequest requests. */ - public requests: google.cloud.vision.v1p4beta1.IAnnotateFileRequest[]; - - /** - * Creates a new BatchAnnotateFilesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateFilesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest): google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest; - - /** - * 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.IBatchAnnotateFilesRequest, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.BatchAnnotateFilesRequest; - - /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.BatchAnnotateFilesRequest; - - /** - * 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 a BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateFilesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest; - - /** - * 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.BatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateFilesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateFilesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchAnnotateFilesResponse. */ - interface IBatchAnnotateFilesResponse { - - /** BatchAnnotateFilesResponse responses */ - responses?: (google.cloud.vision.v1p4beta1.IAnnotateFileResponse[]|null); - } - - /** Represents a BatchAnnotateFilesResponse. */ - class BatchAnnotateFilesResponse implements IBatchAnnotateFilesResponse { - - /** - * Constructs a new BatchAnnotateFilesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse); - - /** BatchAnnotateFilesResponse responses. */ - public responses: google.cloud.vision.v1p4beta1.IAnnotateFileResponse[]; - - /** - * Creates a new BatchAnnotateFilesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchAnnotateFilesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse): google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse; - - /** - * 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.IBatchAnnotateFilesResponse, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.BatchAnnotateFilesResponse; - - /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.BatchAnnotateFilesResponse; - - /** - * 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 a BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchAnnotateFilesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse; - - /** - * 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.BatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchAnnotateFilesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchAnnotateFilesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncAnnotateFileRequest. */ - interface IAsyncAnnotateFileRequest { - - /** AsyncAnnotateFileRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|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 AsyncAnnotateFileRequest. */ - class AsyncAnnotateFileRequest implements IAsyncAnnotateFileRequest { - - /** - * Constructs a new AsyncAnnotateFileRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest); - - /** AsyncAnnotateFileRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); - - /** 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 AsyncAnnotateFileRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncAnnotateFileRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest): google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest; - - /** - * 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.IAsyncAnnotateFileRequest, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AsyncAnnotateFileRequest; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AsyncAnnotateFileRequest; - - /** - * 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 AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncAnnotateFileRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest; - - /** - * 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.AsyncAnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncAnnotateFileRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncAnnotateFileRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncAnnotateFileResponse. */ - interface IAsyncAnnotateFileResponse { - - /** AsyncAnnotateFileResponse outputConfig */ - outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); - } - - /** Represents an AsyncAnnotateFileResponse. */ - class AsyncAnnotateFileResponse implements IAsyncAnnotateFileResponse { - - /** - * Constructs a new AsyncAnnotateFileResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse); - - /** AsyncAnnotateFileResponse outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); - - /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncAnnotateFileResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse): google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse; - - /** - * 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.IAsyncAnnotateFileResponse, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AsyncAnnotateFileResponse; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AsyncAnnotateFileResponse; - - /** - * 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 an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncAnnotateFileResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse; - - /** - * 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.AsyncAnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncAnnotateFileResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncAnnotateFileResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateImagesRequest. */ - interface IAsyncBatchAnnotateImagesRequest { - - /** AsyncBatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]|null); - - /** AsyncBatchAnnotateImagesRequest outputConfig */ - outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); - } - - /** Represents an AsyncBatchAnnotateImagesRequest. */ - class AsyncBatchAnnotateImagesRequest implements IAsyncBatchAnnotateImagesRequest { - - /** - * Constructs a new AsyncBatchAnnotateImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest); - - /** AsyncBatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]; - - /** AsyncBatchAnnotateImagesRequest outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); - - /** - * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; - - /** - * 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.IAsyncBatchAnnotateImagesRequest, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AsyncBatchAnnotateImagesRequest; - - /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AsyncBatchAnnotateImagesRequest; - - /** - * 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 an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; - - /** - * 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.AsyncBatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateImagesResponse. */ - interface IAsyncBatchAnnotateImagesResponse { - - /** AsyncBatchAnnotateImagesResponse outputConfig */ - outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); - } - - /** Represents an AsyncBatchAnnotateImagesResponse. */ - class AsyncBatchAnnotateImagesResponse implements IAsyncBatchAnnotateImagesResponse { - - /** - * Constructs a new AsyncBatchAnnotateImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse); - - /** AsyncBatchAnnotateImagesResponse outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); - - /** - * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; - - /** - * 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.IAsyncBatchAnnotateImagesResponse, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AsyncBatchAnnotateImagesResponse; - - /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AsyncBatchAnnotateImagesResponse; - - /** - * 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 AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; - - /** - * 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.AsyncBatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateFilesRequest. */ - interface IAsyncBatchAnnotateFilesRequest { - - /** AsyncBatchAnnotateFilesRequest requests */ - requests?: (google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest[]|null); - } - - /** Represents an AsyncBatchAnnotateFilesRequest. */ - class AsyncBatchAnnotateFilesRequest implements IAsyncBatchAnnotateFilesRequest { - - /** - * Constructs a new AsyncBatchAnnotateFilesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest); - - /** AsyncBatchAnnotateFilesRequest requests. */ - public requests: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest[]; - - /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; - - /** - * 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.IAsyncBatchAnnotateFilesRequest, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AsyncBatchAnnotateFilesRequest; - - /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AsyncBatchAnnotateFilesRequest; - - /** - * 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 an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateFilesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; - - /** - * 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.AsyncBatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AsyncBatchAnnotateFilesResponse. */ - interface IAsyncBatchAnnotateFilesResponse { - - /** AsyncBatchAnnotateFilesResponse responses */ - responses?: (google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse[]|null); - } - - /** Represents an AsyncBatchAnnotateFilesResponse. */ - class AsyncBatchAnnotateFilesResponse implements IAsyncBatchAnnotateFilesResponse { - - /** - * Constructs a new AsyncBatchAnnotateFilesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse); - - /** AsyncBatchAnnotateFilesResponse responses. */ - public responses: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse[]; - - /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; - - /** - * 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.IAsyncBatchAnnotateFilesResponse, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.AsyncBatchAnnotateFilesResponse; - - /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.AsyncBatchAnnotateFilesResponse; - - /** - * 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 an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AsyncBatchAnnotateFilesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; - - /** - * 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.AsyncBatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InputConfig. */ - interface IInputConfig { - - /** InputConfig gcsSource */ - gcsSource?: (google.cloud.vision.v1p4beta1.IGcsSource|null); - - /** InputConfig content */ - content?: (Uint8Array|string|null); - - /** InputConfig mimeType */ - mimeType?: (string|null); - } - - /** Represents an InputConfig. */ - class InputConfig implements IInputConfig { - - /** - * Constructs a new InputConfig. - * @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); - - /** InputConfig mimeType. */ - public mimeType: string; - - /** - * Creates a new InputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns InputConfig instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IInputConfig): google.cloud.vision.v1p4beta1.InputConfig; - - /** - * 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.IInputConfig, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.InputConfig; - - /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.InputConfig; - - /** - * 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 an InputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.InputConfig; - - /** - * 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.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OutputConfig. */ - interface IOutputConfig { - - /** OutputConfig gcsDestination */ - gcsDestination?: (google.cloud.vision.v1p4beta1.IGcsDestination|null); - - /** OutputConfig batchSize */ - batchSize?: (number|null); - } - - /** Represents an OutputConfig. */ - class OutputConfig implements IOutputConfig { - - /** - * Constructs a new OutputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IOutputConfig); - - /** OutputConfig gcsDestination. */ - public gcsDestination?: (google.cloud.vision.v1p4beta1.IGcsDestination|null); - - /** OutputConfig batchSize. */ - public batchSize: number; - - /** - * Creates a new OutputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns OutputConfig instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IOutputConfig): google.cloud.vision.v1p4beta1.OutputConfig; - - /** - * 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.IOutputConfig, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.OutputConfig; - - /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.OutputConfig; - - /** - * 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 an OutputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OutputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.OutputConfig; - - /** - * 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.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OutputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OutputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GcsSource. */ - interface IGcsSource { - - /** GcsSource uri */ - uri?: (string|null); - } - - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { - - /** - * Constructs a new GcsSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IGcsSource); - - /** GcsSource uri. */ - public uri: string; - - /** - * Creates a new GcsSource instance using the specified properties. - * @param [properties] Properties to set - * @returns GcsSource instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IGcsSource): google.cloud.vision.v1p4beta1.GcsSource; - - /** - * 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.IGcsSource, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.GcsSource; - - /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.GcsSource; - - /** - * 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 GcsSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GcsSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GcsSource; - - /** - * 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.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GcsSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GcsSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GcsDestination. */ - interface IGcsDestination { - - /** GcsDestination uri */ - uri?: (string|null); - } - - /** Represents a GcsDestination. */ - class GcsDestination implements IGcsDestination { - - /** - * Constructs a new GcsDestination. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IGcsDestination); - - /** GcsDestination uri. */ - public uri: string; - - /** - * Creates a new GcsDestination instance using the specified properties. - * @param [properties] Properties to set - * @returns GcsDestination instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IGcsDestination): google.cloud.vision.v1p4beta1.GcsDestination; - - /** - * 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.IGcsDestination, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.GcsDestination; - - /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.GcsDestination; - - /** - * 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 GcsDestination message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GcsDestination - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GcsDestination; - - /** - * 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.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GcsDestination to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GcsDestination - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** 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); - - /** OperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents an OperationMetadata. */ - class OperationMetadata implements IOperationMetadata { - - /** - * Constructs a new OperationMetadata. - * @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); - - /** OperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationMetadata instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IOperationMetadata): google.cloud.vision.v1p4beta1.OperationMetadata; - - /** - * 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.IOperationMetadata, 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 - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * 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 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.OperationMetadata; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @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.OperationMetadata; - - /** - * 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 an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.OperationMetadata; - - /** - * 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.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace OperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - CREATED = 1, - RUNNING = 2, - DONE = 3, - CANCELLED = 4 - } - } - - /** Properties of a ProductSearchParams. */ - interface IProductSearchParams { - - /** ProductSearchParams boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** ProductSearchParams productSet */ - productSet?: (string|null); - - /** ProductSearchParams productCategories */ - productCategories?: (string[]|null); - - /** ProductSearchParams filter */ - filter?: (string|null); - } - - /** Represents a ProductSearchParams. */ - class ProductSearchParams implements IProductSearchParams { - - /** - * Constructs a new ProductSearchParams. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IProductSearchParams); - - /** ProductSearchParams boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** ProductSearchParams productSet. */ - public productSet: string; - - /** ProductSearchParams productCategories. */ - public productCategories: string[]; - - /** ProductSearchParams filter. */ - public filter: string; - - /** - * Creates a new ProductSearchParams instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSearchParams instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IProductSearchParams): google.cloud.vision.v1p4beta1.ProductSearchParams; - - /** - * Encodes the specified ProductSearchParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchParams.verify|verify} messages. - * @param message ProductSearchParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IProductSearchParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSearchParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchParams.verify|verify} messages. - * @param message ProductSearchParams message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IProductSearchParams, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSearchParams - * @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.ProductSearchParams; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSearchParams - * @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.ProductSearchParams; - - /** - * Verifies a ProductSearchParams 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 ProductSearchParams message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSearchParams - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ProductSearchParams; - - /** - * Creates a plain object from a ProductSearchParams message. Also converts values to other types if specified. - * @param message ProductSearchParams - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ProductSearchParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSearchParams to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSearchParams - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ProductSearchResults. */ - interface IProductSearchResults { - - /** ProductSearchResults indexTime */ - indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSearchResults results */ - results?: (google.cloud.vision.v1p4beta1.ProductSearchResults.IResult[]|null); - - /** ProductSearchResults productGroupedResults */ - productGroupedResults?: (google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult[]|null); - } - - /** Represents a ProductSearchResults. */ - class ProductSearchResults implements IProductSearchResults { - - /** - * Constructs a new ProductSearchResults. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IProductSearchResults); - - /** ProductSearchResults indexTime. */ - public indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSearchResults results. */ - public results: google.cloud.vision.v1p4beta1.ProductSearchResults.IResult[]; - - /** ProductSearchResults productGroupedResults. */ - public productGroupedResults: google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult[]; - - /** - * Creates a new ProductSearchResults instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSearchResults instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IProductSearchResults): google.cloud.vision.v1p4beta1.ProductSearchResults; - - /** - * Encodes the specified ProductSearchResults message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.verify|verify} messages. - * @param message ProductSearchResults message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IProductSearchResults, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSearchResults message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.verify|verify} messages. - * @param message ProductSearchResults message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IProductSearchResults, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSearchResults - * @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.ProductSearchResults; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSearchResults - * @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.ProductSearchResults; - - /** - * Verifies a ProductSearchResults 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 ProductSearchResults message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSearchResults - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ProductSearchResults; - - /** - * Creates a plain object from a ProductSearchResults message. Also converts values to other types if specified. - * @param message ProductSearchResults - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ProductSearchResults, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSearchResults to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSearchResults - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ProductSearchResults { - - /** Properties of a Result. */ - interface IResult { - - /** Result product */ - product?: (google.cloud.vision.v1p4beta1.IProduct|null); - - /** Result score */ - score?: (number|null); - - /** Result image */ - image?: (string|null); - } - - /** Represents a Result. */ - class Result implements IResult { - - /** - * Constructs a new Result. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ProductSearchResults.IResult); - - /** Result product. */ - public product?: (google.cloud.vision.v1p4beta1.IProduct|null); - - /** Result score. */ - public score: number; - - /** Result image. */ - public image: string; - - /** - * Creates a new Result instance using the specified properties. - * @param [properties] Properties to set - * @returns Result instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ProductSearchResults.IResult): google.cloud.vision.v1p4beta1.ProductSearchResults.Result; - - /** - * Encodes the specified Result message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.Result.verify|verify} messages. - * @param message Result message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ProductSearchResults.IResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Result message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.Result.verify|verify} messages. - * @param message Result message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ProductSearchResults.IResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Result message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Result - * @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.ProductSearchResults.Result; - - /** - * Decodes a Result message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Result - * @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.ProductSearchResults.Result; - - /** - * Verifies a Result 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 Result message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Result - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ProductSearchResults.Result; - - /** - * Creates a plain object from a Result message. Also converts values to other types if specified. - * @param message Result - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ProductSearchResults.Result, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Result to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Result - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ObjectAnnotation. */ - interface IObjectAnnotation { - - /** ObjectAnnotation mid */ - mid?: (string|null); - - /** ObjectAnnotation languageCode */ - languageCode?: (string|null); - - /** ObjectAnnotation name */ - name?: (string|null); - - /** ObjectAnnotation score */ - score?: (number|null); - } - - /** Represents an ObjectAnnotation. */ - class ObjectAnnotation implements IObjectAnnotation { - - /** - * Constructs a new ObjectAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation); - - /** ObjectAnnotation mid. */ - public mid: string; - - /** ObjectAnnotation languageCode. */ - public languageCode: string; - - /** ObjectAnnotation name. */ - public name: string; - - /** ObjectAnnotation score. */ - public score: number; - - /** - * Creates a new ObjectAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns ObjectAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation): google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation; - - /** - * Encodes the specified ObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @param message ObjectAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @param message ObjectAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation; - - /** - * Verifies an ObjectAnnotation 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 ObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ObjectAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation; - - /** - * Creates a plain object from an ObjectAnnotation message. Also converts values to other types if specified. - * @param message ObjectAnnotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ObjectAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ObjectAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GroupedResult. */ - interface IGroupedResult { - - /** GroupedResult boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** GroupedResult results */ - results?: (google.cloud.vision.v1p4beta1.ProductSearchResults.IResult[]|null); - - /** GroupedResult objectAnnotations */ - objectAnnotations?: (google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation[]|null); - } - - /** Represents a GroupedResult. */ - class GroupedResult implements IGroupedResult { - - /** - * Constructs a new GroupedResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult); - - /** GroupedResult boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** GroupedResult results. */ - public results: google.cloud.vision.v1p4beta1.ProductSearchResults.IResult[]; - - /** GroupedResult objectAnnotations. */ - public objectAnnotations: google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation[]; - - /** - * Creates a new GroupedResult instance using the specified properties. - * @param [properties] Properties to set - * @returns GroupedResult instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult): google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult; - - /** - * Encodes the specified GroupedResult message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @param message GroupedResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GroupedResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @param message GroupedResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GroupedResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GroupedResult - * @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.ProductSearchResults.GroupedResult; - - /** - * Decodes a GroupedResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GroupedResult - * @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.ProductSearchResults.GroupedResult; - - /** - * Verifies a GroupedResult 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 GroupedResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GroupedResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult; - - /** - * Creates a plain object from a GroupedResult message. Also converts values to other types if specified. - * @param message GroupedResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GroupedResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GroupedResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Represents a ProductSearch */ - class ProductSearch extends $protobuf.rpc.Service { - - /** - * Constructs a new ProductSearch 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); - - /** - * Creates new ProductSearch 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): ProductSearch; - - /** - * Calls CreateProductSet. - * @param request CreateProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public createProductSet(request: google.cloud.vision.v1p4beta1.ICreateProductSetRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.CreateProductSetCallback): void; - - /** - * Calls CreateProductSet. - * @param request CreateProductSetRequest message or plain object - * @returns Promise - */ - public createProductSet(request: google.cloud.vision.v1p4beta1.ICreateProductSetRequest): Promise; - - /** - * Calls ListProductSets. - * @param request ListProductSetsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductSetsResponse - */ - public listProductSets(request: google.cloud.vision.v1p4beta1.IListProductSetsRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.ListProductSetsCallback): void; - - /** - * Calls ListProductSets. - * @param request ListProductSetsRequest message or plain object - * @returns Promise - */ - public listProductSets(request: google.cloud.vision.v1p4beta1.IListProductSetsRequest): Promise; - - /** - * Calls GetProductSet. - * @param request GetProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public getProductSet(request: google.cloud.vision.v1p4beta1.IGetProductSetRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.GetProductSetCallback): void; - - /** - * Calls GetProductSet. - * @param request GetProductSetRequest message or plain object - * @returns Promise - */ - public getProductSet(request: google.cloud.vision.v1p4beta1.IGetProductSetRequest): Promise; - - /** - * Calls UpdateProductSet. - * @param request UpdateProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ProductSet - */ - public updateProductSet(request: google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.UpdateProductSetCallback): void; - - /** - * Calls UpdateProductSet. - * @param request UpdateProductSetRequest message or plain object - * @returns Promise - */ - public updateProductSet(request: google.cloud.vision.v1p4beta1.IUpdateProductSetRequest): Promise; - - /** - * Calls DeleteProductSet. - * @param request DeleteProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteProductSet(request: google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.DeleteProductSetCallback): void; - - /** - * Calls DeleteProductSet. - * @param request DeleteProductSetRequest message or plain object - * @returns Promise - */ - public deleteProductSet(request: google.cloud.vision.v1p4beta1.IDeleteProductSetRequest): Promise; - - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public createProduct(request: google.cloud.vision.v1p4beta1.ICreateProductRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.CreateProductCallback): void; - - /** - * Calls CreateProduct. - * @param request CreateProductRequest message or plain object - * @returns Promise - */ - public createProduct(request: google.cloud.vision.v1p4beta1.ICreateProductRequest): Promise; - - /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsResponse - */ - public listProducts(request: google.cloud.vision.v1p4beta1.IListProductsRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.ListProductsCallback): void; - - /** - * Calls ListProducts. - * @param request ListProductsRequest message or plain object - * @returns Promise - */ - public listProducts(request: google.cloud.vision.v1p4beta1.IListProductsRequest): Promise; - - /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public getProduct(request: google.cloud.vision.v1p4beta1.IGetProductRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.GetProductCallback): void; - - /** - * Calls GetProduct. - * @param request GetProductRequest message or plain object - * @returns Promise - */ - public getProduct(request: google.cloud.vision.v1p4beta1.IGetProductRequest): Promise; - - /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Product - */ - public updateProduct(request: google.cloud.vision.v1p4beta1.IUpdateProductRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.UpdateProductCallback): void; - - /** - * Calls UpdateProduct. - * @param request UpdateProductRequest message or plain object - * @returns Promise - */ - public updateProduct(request: google.cloud.vision.v1p4beta1.IUpdateProductRequest): Promise; - - /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteProduct(request: google.cloud.vision.v1p4beta1.IDeleteProductRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.DeleteProductCallback): void; - - /** - * Calls DeleteProduct. - * @param request DeleteProductRequest message or plain object - * @returns Promise - */ - public deleteProduct(request: google.cloud.vision.v1p4beta1.IDeleteProductRequest): Promise; - - /** - * Calls CreateReferenceImage. - * @param request CreateReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ReferenceImage - */ - public createReferenceImage(request: google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.CreateReferenceImageCallback): void; - - /** - * Calls CreateReferenceImage. - * @param request CreateReferenceImageRequest message or plain object - * @returns Promise - */ - public createReferenceImage(request: google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest): Promise; - - /** - * Calls DeleteReferenceImage. - * @param request DeleteReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteReferenceImage(request: google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.DeleteReferenceImageCallback): void; - - /** - * Calls DeleteReferenceImage. - * @param request DeleteReferenceImageRequest message or plain object - * @returns Promise - */ - public deleteReferenceImage(request: google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest): Promise; - - /** - * Calls ListReferenceImages. - * @param request ListReferenceImagesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListReferenceImagesResponse - */ - public listReferenceImages(request: google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.ListReferenceImagesCallback): void; - - /** - * Calls ListReferenceImages. - * @param request ListReferenceImagesRequest message or plain object - * @returns Promise - */ - public listReferenceImages(request: google.cloud.vision.v1p4beta1.IListReferenceImagesRequest): Promise; - - /** - * Calls GetReferenceImage. - * @param request GetReferenceImageRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ReferenceImage - */ - public getReferenceImage(request: google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.GetReferenceImageCallback): void; - - /** - * Calls GetReferenceImage. - * @param request GetReferenceImageRequest message or plain object - * @returns Promise - */ - public getReferenceImage(request: google.cloud.vision.v1p4beta1.IGetReferenceImageRequest): Promise; - - /** - * Calls AddProductToProductSet. - * @param request AddProductToProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public addProductToProductSet(request: google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.AddProductToProductSetCallback): void; - - /** - * Calls AddProductToProductSet. - * @param request AddProductToProductSetRequest message or plain object - * @returns Promise - */ - public addProductToProductSet(request: google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest): Promise; - - /** - * Calls RemoveProductFromProductSet. - * @param request RemoveProductFromProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public removeProductFromProductSet(request: google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.RemoveProductFromProductSetCallback): void; - - /** - * Calls RemoveProductFromProductSet. - * @param request RemoveProductFromProductSetRequest message or plain object - * @returns Promise - */ - public removeProductFromProductSet(request: google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest): Promise; - - /** - * Calls ListProductsInProductSet. - * @param request ListProductsInProductSetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListProductsInProductSetResponse - */ - public listProductsInProductSet(request: google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.ListProductsInProductSetCallback): void; - - /** - * Calls ListProductsInProductSet. - * @param request ListProductsInProductSetRequest message or plain object - * @returns Promise - */ - public listProductsInProductSet(request: google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest): Promise; - - /** - * Calls ImportProductSets. - * @param request ImportProductSetsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public importProductSets(request: google.cloud.vision.v1p4beta1.IImportProductSetsRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.ImportProductSetsCallback): void; - - /** - * Calls ImportProductSets. - * @param request ImportProductSetsRequest message or plain object - * @returns Promise - */ - public importProductSets(request: google.cloud.vision.v1p4beta1.IImportProductSetsRequest): Promise; - - /** - * Calls PurgeProducts. - * @param request PurgeProductsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public purgeProducts(request: google.cloud.vision.v1p4beta1.IPurgeProductsRequest, callback: google.cloud.vision.v1p4beta1.ProductSearch.PurgeProductsCallback): void; - - /** - * Calls PurgeProducts. - * @param request PurgeProductsRequest message or plain object - * @returns Promise - */ - public purgeProducts(request: google.cloud.vision.v1p4beta1.IPurgeProductsRequest): Promise; - } - - namespace ProductSearch { - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|createProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type CreateProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|listProductSets}. - * @param error Error, if any - * @param [response] ListProductSetsResponse - */ - type ListProductSetsCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ListProductSetsResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|getProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type GetProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|updateProductSet}. - * @param error Error, if any - * @param [response] ProductSet - */ - type UpdateProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ProductSet) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|deleteProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|createProduct}. - * @param error Error, if any - * @param [response] Product - */ - type CreateProductCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|listProducts}. - * @param error Error, if any - * @param [response] ListProductsResponse - */ - type ListProductsCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ListProductsResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|getProduct}. - * @param error Error, if any - * @param [response] Product - */ - type GetProductCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|updateProduct}. - * @param error Error, if any - * @param [response] Product - */ - type UpdateProductCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.Product) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|deleteProduct}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteProductCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|createReferenceImage}. - * @param error Error, if any - * @param [response] ReferenceImage - */ - type CreateReferenceImageCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ReferenceImage) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|deleteReferenceImage}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteReferenceImageCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|listReferenceImages}. - * @param error Error, if any - * @param [response] ListReferenceImagesResponse - */ - type ListReferenceImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ListReferenceImagesResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|getReferenceImage}. - * @param error Error, if any - * @param [response] ReferenceImage - */ - type GetReferenceImageCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ReferenceImage) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|addProductToProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type AddProductToProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|removeProductFromProductSet}. - * @param error Error, if any - * @param [response] Empty - */ - type RemoveProductFromProductSetCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|listProductsInProductSet}. - * @param error Error, if any - * @param [response] ListProductsInProductSetResponse - */ - type ListProductsInProductSetCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|importProductSets}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportProductSetsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|purgeProducts}. - * @param error Error, if any - * @param [response] Operation - */ - type PurgeProductsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a Product. */ - interface IProduct { - - /** Product name */ - name?: (string|null); - - /** Product displayName */ - displayName?: (string|null); - - /** Product description */ - description?: (string|null); - - /** Product productCategory */ - productCategory?: (string|null); - - /** Product productLabels */ - productLabels?: (google.cloud.vision.v1p4beta1.Product.IKeyValue[]|null); - } - - /** Represents a Product. */ - class Product implements IProduct { - - /** - * Constructs a new Product. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IProduct); - - /** Product name. */ - public name: string; - - /** Product displayName. */ - public displayName: string; - - /** Product description. */ - public description: string; - - /** Product productCategory. */ - public productCategory: string; - - /** Product productLabels. */ - public productLabels: google.cloud.vision.v1p4beta1.Product.IKeyValue[]; - - /** - * Creates a new Product instance using the specified properties. - * @param [properties] Properties to set - * @returns Product instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IProduct): google.cloud.vision.v1p4beta1.Product; - - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Product.verify|verify} messages. - * @param message Product message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Product message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Product - * @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.Product; - - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Product - * @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.Product; - - /** - * Verifies a Product 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 Product message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Product - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Product; - - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @param message Product - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Product to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Product - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Product { - - /** Properties of a KeyValue. */ - interface IKeyValue { - - /** KeyValue key */ - key?: (string|null); - - /** KeyValue value */ - value?: (string|null); - } - - /** Represents a KeyValue. */ - class KeyValue implements IKeyValue { - - /** - * Constructs a new KeyValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.Product.IKeyValue); - - /** KeyValue key. */ - public key: string; - - /** KeyValue value. */ - public value: string; - - /** - * Creates a new KeyValue instance using the specified properties. - * @param [properties] Properties to set - * @returns KeyValue instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.Product.IKeyValue): google.cloud.vision.v1p4beta1.Product.KeyValue; - - /** - * Encodes the specified KeyValue message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Product.KeyValue.verify|verify} messages. - * @param message KeyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.Product.IKeyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Product.KeyValue.verify|verify} messages. - * @param message KeyValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.Product.IKeyValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a KeyValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns KeyValue - * @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.Product.KeyValue; - - /** - * Decodes a KeyValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns KeyValue - * @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.Product.KeyValue; - - /** - * Verifies a KeyValue 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 KeyValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns KeyValue - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Product.KeyValue; - - /** - * Creates a plain object from a KeyValue message. Also converts values to other types if specified. - * @param message KeyValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.Product.KeyValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this KeyValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for KeyValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a ProductSet. */ - interface IProductSet { - - /** ProductSet name */ - name?: (string|null); - - /** ProductSet displayName */ - displayName?: (string|null); - - /** ProductSet indexTime */ - indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSet indexError */ - indexError?: (google.rpc.IStatus|null); - } - - /** Represents a ProductSet. */ - class ProductSet implements IProductSet { - - /** - * Constructs a new ProductSet. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IProductSet); - - /** ProductSet name. */ - public name: string; - - /** ProductSet displayName. */ - public displayName: string; - - /** ProductSet indexTime. */ - public indexTime?: (google.protobuf.ITimestamp|null); - - /** ProductSet indexError. */ - public indexError?: (google.rpc.IStatus|null); - - /** - * Creates a new ProductSet instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSet instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IProductSet): google.cloud.vision.v1p4beta1.ProductSet; - - /** - * Encodes the specified ProductSet message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSet.verify|verify} messages. - * @param message ProductSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IProductSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSet message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSet.verify|verify} messages. - * @param message ProductSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IProductSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSet - * @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.ProductSet; - - /** - * Decodes a ProductSet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSet - * @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.ProductSet; - - /** - * Verifies a ProductSet 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 ProductSet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSet - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ProductSet; - - /** - * Creates a plain object from a ProductSet message. Also converts values to other types if specified. - * @param message ProductSet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ProductSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSet - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReferenceImage. */ - interface IReferenceImage { - - /** ReferenceImage name */ - name?: (string|null); - - /** ReferenceImage uri */ - uri?: (string|null); - - /** ReferenceImage boundingPolys */ - boundingPolys?: (google.cloud.vision.v1p4beta1.IBoundingPoly[]|null); - } - - /** Represents a ReferenceImage. */ - class ReferenceImage implements IReferenceImage { - - /** - * Constructs a new ReferenceImage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IReferenceImage); - - /** ReferenceImage name. */ - public name: string; - - /** ReferenceImage uri. */ - public uri: string; - - /** ReferenceImage boundingPolys. */ - public boundingPolys: google.cloud.vision.v1p4beta1.IBoundingPoly[]; - - /** - * Creates a new ReferenceImage instance using the specified properties. - * @param [properties] Properties to set - * @returns ReferenceImage instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IReferenceImage): google.cloud.vision.v1p4beta1.ReferenceImage; - - /** - * Encodes the specified ReferenceImage message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ReferenceImage.verify|verify} messages. - * @param message ReferenceImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IReferenceImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReferenceImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ReferenceImage.verify|verify} messages. - * @param message ReferenceImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IReferenceImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReferenceImage - * @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.ReferenceImage; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReferenceImage - * @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.ReferenceImage; - - /** - * Verifies a ReferenceImage 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 ReferenceImage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReferenceImage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ReferenceImage; - - /** - * Creates a plain object from a ReferenceImage message. Also converts values to other types if specified. - * @param message ReferenceImage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ReferenceImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReferenceImage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReferenceImage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateProductRequest. */ - interface ICreateProductRequest { - - /** CreateProductRequest parent */ - parent?: (string|null); - - /** CreateProductRequest product */ - product?: (google.cloud.vision.v1p4beta1.IProduct|null); - - /** CreateProductRequest productId */ - productId?: (string|null); - } - - /** Represents a CreateProductRequest. */ - class CreateProductRequest implements ICreateProductRequest { - - /** - * Constructs a new CreateProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICreateProductRequest); - - /** CreateProductRequest parent. */ - public parent: string; - - /** CreateProductRequest product. */ - public product?: (google.cloud.vision.v1p4beta1.IProduct|null); - - /** CreateProductRequest productId. */ - public productId: string; - - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICreateProductRequest): google.cloud.vision.v1p4beta1.CreateProductRequest; - - /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateProductRequest.verify|verify} messages. - * @param message CreateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICreateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateProductRequest - * @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.CreateProductRequest; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateProductRequest - * @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.CreateProductRequest; - - /** - * Verifies a CreateProductRequest 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 CreateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CreateProductRequest; - - /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @param message CreateProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.CreateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsRequest. */ - interface IListProductsRequest { - - /** ListProductsRequest parent */ - parent?: (string|null); - - /** ListProductsRequest pageSize */ - pageSize?: (number|null); - - /** ListProductsRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductsRequest. */ - class ListProductsRequest implements IListProductsRequest { - - /** - * Constructs a new ListProductsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IListProductsRequest); - - /** ListProductsRequest parent. */ - public parent: string; - - /** ListProductsRequest pageSize. */ - public pageSize: number; - - /** ListProductsRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IListProductsRequest): google.cloud.vision.v1p4beta1.ListProductsRequest; - - /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsRequest.verify|verify} messages. - * @param message ListProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IListProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsRequest - * @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.ListProductsRequest; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsRequest - * @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.ListProductsRequest; - - /** - * Verifies a ListProductsRequest 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 ListProductsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ListProductsRequest; - - /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. - * @param message ListProductsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ListProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsResponse. */ - interface IListProductsResponse { - - /** ListProductsResponse products */ - products?: (google.cloud.vision.v1p4beta1.IProduct[]|null); - - /** ListProductsResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductsResponse. */ - class ListProductsResponse implements IListProductsResponse { - - /** - * Constructs a new ListProductsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IListProductsResponse); - - /** ListProductsResponse products. */ - public products: google.cloud.vision.v1p4beta1.IProduct[]; - - /** ListProductsResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IListProductsResponse): google.cloud.vision.v1p4beta1.ListProductsResponse; - - /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsResponse.verify|verify} messages. - * @param message ListProductsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IListProductsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsResponse - * @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.ListProductsResponse; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsResponse - * @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.ListProductsResponse; - - /** - * Verifies a ListProductsResponse 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 ListProductsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ListProductsResponse; - - /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. - * @param message ListProductsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ListProductsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetProductRequest. */ - interface IGetProductRequest { - - /** GetProductRequest name */ - name?: (string|null); - } - - /** Represents a GetProductRequest. */ - class GetProductRequest implements IGetProductRequest { - - /** - * Constructs a new GetProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IGetProductRequest); - - /** GetProductRequest name. */ - public name: string; - - /** - * Creates a new GetProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IGetProductRequest): google.cloud.vision.v1p4beta1.GetProductRequest; - - /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetProductRequest.verify|verify} messages. - * @param message GetProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGetProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetProductRequest - * @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.GetProductRequest; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetProductRequest - * @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.GetProductRequest; - - /** - * Verifies a GetProductRequest 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 GetProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GetProductRequest; - - /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @param message GetProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.GetProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an UpdateProductRequest. */ - interface IUpdateProductRequest { - - /** UpdateProductRequest product */ - product?: (google.cloud.vision.v1p4beta1.IProduct|null); - - /** UpdateProductRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateProductRequest. */ - class UpdateProductRequest implements IUpdateProductRequest { - - /** - * Constructs a new UpdateProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IUpdateProductRequest); - - /** UpdateProductRequest product. */ - public product?: (google.cloud.vision.v1p4beta1.IProduct|null); - - /** UpdateProductRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IUpdateProductRequest): google.cloud.vision.v1p4beta1.UpdateProductRequest; - - /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.UpdateProductRequest.verify|verify} messages. - * @param message UpdateProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IUpdateProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateProductRequest - * @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.UpdateProductRequest; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateProductRequest - * @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.UpdateProductRequest; - - /** - * Verifies an UpdateProductRequest 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 UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.UpdateProductRequest; - - /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @param message UpdateProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.UpdateProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UpdateProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UpdateProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteProductRequest. */ - interface IDeleteProductRequest { - - /** DeleteProductRequest name */ - name?: (string|null); - } - - /** Represents a DeleteProductRequest. */ - class DeleteProductRequest implements IDeleteProductRequest { - - /** - * Constructs a new DeleteProductRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IDeleteProductRequest); - - /** DeleteProductRequest name. */ - public name: string; - - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteProductRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IDeleteProductRequest): google.cloud.vision.v1p4beta1.DeleteProductRequest; - - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteProductRequest.verify|verify} messages. - * @param message DeleteProductRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IDeleteProductRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteProductRequest - * @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.DeleteProductRequest; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteProductRequest - * @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.DeleteProductRequest; - - /** - * Verifies a DeleteProductRequest 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 DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteProductRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.DeleteProductRequest; - - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @param message DeleteProductRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.DeleteProductRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteProductRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteProductRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateProductSetRequest. */ - interface ICreateProductSetRequest { - - /** CreateProductSetRequest parent */ - parent?: (string|null); - - /** CreateProductSetRequest productSet */ - productSet?: (google.cloud.vision.v1p4beta1.IProductSet|null); - - /** CreateProductSetRequest productSetId */ - productSetId?: (string|null); - } - - /** Represents a CreateProductSetRequest. */ - class CreateProductSetRequest implements ICreateProductSetRequest { - - /** - * Constructs a new CreateProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICreateProductSetRequest); - - /** CreateProductSetRequest parent. */ - public parent: string; - - /** CreateProductSetRequest productSet. */ - public productSet?: (google.cloud.vision.v1p4beta1.IProductSet|null); - - /** CreateProductSetRequest productSetId. */ - public productSetId: string; - - /** - * Creates a new CreateProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICreateProductSetRequest): google.cloud.vision.v1p4beta1.CreateProductSetRequest; - - /** - * Encodes the specified CreateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateProductSetRequest.verify|verify} messages. - * @param message CreateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ICreateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateProductSetRequest.verify|verify} messages. - * @param message CreateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICreateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateProductSetRequest - * @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.CreateProductSetRequest; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateProductSetRequest - * @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.CreateProductSetRequest; - - /** - * Verifies a CreateProductSetRequest 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 CreateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CreateProductSetRequest; - - /** - * Creates a plain object from a CreateProductSetRequest message. Also converts values to other types if specified. - * @param message CreateProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.CreateProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductSetsRequest. */ - interface IListProductSetsRequest { - - /** ListProductSetsRequest parent */ - parent?: (string|null); - - /** ListProductSetsRequest pageSize */ - pageSize?: (number|null); - - /** ListProductSetsRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductSetsRequest. */ - class ListProductSetsRequest implements IListProductSetsRequest { - - /** - * Constructs a new ListProductSetsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IListProductSetsRequest); - - /** ListProductSetsRequest parent. */ - public parent: string; - - /** ListProductSetsRequest pageSize. */ - public pageSize: number; - - /** ListProductSetsRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductSetsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductSetsRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IListProductSetsRequest): google.cloud.vision.v1p4beta1.ListProductSetsRequest; - - /** - * Encodes the specified ListProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductSetsRequest.verify|verify} messages. - * @param message ListProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IListProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductSetsRequest.verify|verify} messages. - * @param message ListProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IListProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductSetsRequest - * @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.ListProductSetsRequest; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductSetsRequest - * @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.ListProductSetsRequest; - - /** - * Verifies a ListProductSetsRequest 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 ListProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductSetsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ListProductSetsRequest; - - /** - * Creates a plain object from a ListProductSetsRequest message. Also converts values to other types if specified. - * @param message ListProductSetsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ListProductSetsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductSetsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductSetsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductSetsResponse. */ - interface IListProductSetsResponse { - - /** ListProductSetsResponse productSets */ - productSets?: (google.cloud.vision.v1p4beta1.IProductSet[]|null); - - /** ListProductSetsResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductSetsResponse. */ - class ListProductSetsResponse implements IListProductSetsResponse { - - /** - * Constructs a new ListProductSetsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IListProductSetsResponse); - - /** ListProductSetsResponse productSets. */ - public productSets: google.cloud.vision.v1p4beta1.IProductSet[]; - - /** ListProductSetsResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductSetsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductSetsResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IListProductSetsResponse): google.cloud.vision.v1p4beta1.ListProductSetsResponse; - - /** - * Encodes the specified ListProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductSetsResponse.verify|verify} messages. - * @param message ListProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IListProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductSetsResponse.verify|verify} messages. - * @param message ListProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IListProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductSetsResponse - * @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.ListProductSetsResponse; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductSetsResponse - * @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.ListProductSetsResponse; - - /** - * Verifies a ListProductSetsResponse 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 ListProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductSetsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ListProductSetsResponse; - - /** - * Creates a plain object from a ListProductSetsResponse message. Also converts values to other types if specified. - * @param message ListProductSetsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ListProductSetsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductSetsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductSetsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetProductSetRequest. */ - interface IGetProductSetRequest { - - /** GetProductSetRequest name */ - name?: (string|null); - } - - /** Represents a GetProductSetRequest. */ - class GetProductSetRequest implements IGetProductSetRequest { - - /** - * Constructs a new GetProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IGetProductSetRequest); - - /** GetProductSetRequest name. */ - public name: string; - - /** - * Creates a new GetProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IGetProductSetRequest): google.cloud.vision.v1p4beta1.GetProductSetRequest; - - /** - * Encodes the specified GetProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetProductSetRequest.verify|verify} messages. - * @param message GetProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IGetProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetProductSetRequest.verify|verify} messages. - * @param message GetProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGetProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetProductSetRequest - * @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.GetProductSetRequest; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetProductSetRequest - * @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.GetProductSetRequest; - - /** - * Verifies a GetProductSetRequest 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 GetProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GetProductSetRequest; - - /** - * Creates a plain object from a GetProductSetRequest message. Also converts values to other types if specified. - * @param message GetProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.GetProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an UpdateProductSetRequest. */ - interface IUpdateProductSetRequest { - - /** UpdateProductSetRequest productSet */ - productSet?: (google.cloud.vision.v1p4beta1.IProductSet|null); - - /** UpdateProductSetRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateProductSetRequest. */ - class UpdateProductSetRequest implements IUpdateProductSetRequest { - - /** - * Constructs a new UpdateProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IUpdateProductSetRequest); - - /** UpdateProductSetRequest productSet. */ - public productSet?: (google.cloud.vision.v1p4beta1.IProductSet|null); - - /** UpdateProductSetRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** - * Creates a new UpdateProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IUpdateProductSetRequest): google.cloud.vision.v1p4beta1.UpdateProductSetRequest; - - /** - * Encodes the specified UpdateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.UpdateProductSetRequest.verify|verify} messages. - * @param message UpdateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.UpdateProductSetRequest.verify|verify} messages. - * @param message UpdateProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateProductSetRequest - * @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.UpdateProductSetRequest; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateProductSetRequest - * @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.UpdateProductSetRequest; - - /** - * Verifies an UpdateProductSetRequest 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 UpdateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.UpdateProductSetRequest; - - /** - * Creates a plain object from an UpdateProductSetRequest message. Also converts values to other types if specified. - * @param message UpdateProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.UpdateProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UpdateProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UpdateProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteProductSetRequest. */ - interface IDeleteProductSetRequest { - - /** DeleteProductSetRequest name */ - name?: (string|null); - } - - /** Represents a DeleteProductSetRequest. */ - class DeleteProductSetRequest implements IDeleteProductSetRequest { - - /** - * Constructs a new DeleteProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IDeleteProductSetRequest); - - /** DeleteProductSetRequest name. */ - public name: string; - - /** - * Creates a new DeleteProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IDeleteProductSetRequest): google.cloud.vision.v1p4beta1.DeleteProductSetRequest; - - /** - * Encodes the specified DeleteProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteProductSetRequest.verify|verify} messages. - * @param message DeleteProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteProductSetRequest.verify|verify} messages. - * @param message DeleteProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteProductSetRequest - * @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.DeleteProductSetRequest; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteProductSetRequest - * @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.DeleteProductSetRequest; - - /** - * Verifies a DeleteProductSetRequest 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 DeleteProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.DeleteProductSetRequest; - - /** - * Creates a plain object from a DeleteProductSetRequest message. Also converts values to other types if specified. - * @param message DeleteProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.DeleteProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CreateReferenceImageRequest. */ - interface ICreateReferenceImageRequest { - - /** CreateReferenceImageRequest parent */ - parent?: (string|null); - - /** CreateReferenceImageRequest referenceImage */ - referenceImage?: (google.cloud.vision.v1p4beta1.IReferenceImage|null); - - /** CreateReferenceImageRequest referenceImageId */ - referenceImageId?: (string|null); - } - - /** Represents a CreateReferenceImageRequest. */ - class CreateReferenceImageRequest implements ICreateReferenceImageRequest { - - /** - * Constructs a new CreateReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest); - - /** CreateReferenceImageRequest parent. */ - public parent: string; - - /** CreateReferenceImageRequest referenceImage. */ - public referenceImage?: (google.cloud.vision.v1p4beta1.IReferenceImage|null); - - /** CreateReferenceImageRequest referenceImageId. */ - public referenceImageId: string; - - /** - * Creates a new CreateReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest): google.cloud.vision.v1p4beta1.CreateReferenceImageRequest; - - /** - * Encodes the specified CreateReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateReferenceImageRequest.verify|verify} messages. - * @param message CreateReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateReferenceImageRequest.verify|verify} messages. - * @param message CreateReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateReferenceImageRequest - * @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.CreateReferenceImageRequest; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateReferenceImageRequest - * @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.CreateReferenceImageRequest; - - /** - * Verifies a CreateReferenceImageRequest 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 CreateReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CreateReferenceImageRequest; - - /** - * Creates a plain object from a CreateReferenceImageRequest message. Also converts values to other types if specified. - * @param message CreateReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.CreateReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListReferenceImagesRequest. */ - interface IListReferenceImagesRequest { - - /** ListReferenceImagesRequest parent */ - parent?: (string|null); - - /** ListReferenceImagesRequest pageSize */ - pageSize?: (number|null); - - /** ListReferenceImagesRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListReferenceImagesRequest. */ - class ListReferenceImagesRequest implements IListReferenceImagesRequest { - - /** - * Constructs a new ListReferenceImagesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IListReferenceImagesRequest); - - /** ListReferenceImagesRequest parent. */ - public parent: string; - - /** ListReferenceImagesRequest pageSize. */ - public pageSize: number; - - /** ListReferenceImagesRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListReferenceImagesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListReferenceImagesRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IListReferenceImagesRequest): google.cloud.vision.v1p4beta1.ListReferenceImagesRequest; - - /** - * Encodes the specified ListReferenceImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListReferenceImagesRequest.verify|verify} messages. - * @param message ListReferenceImagesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListReferenceImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListReferenceImagesRequest.verify|verify} messages. - * @param message ListReferenceImagesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListReferenceImagesRequest - * @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.ListReferenceImagesRequest; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListReferenceImagesRequest - * @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.ListReferenceImagesRequest; - - /** - * Verifies a ListReferenceImagesRequest 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 ListReferenceImagesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListReferenceImagesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ListReferenceImagesRequest; - - /** - * Creates a plain object from a ListReferenceImagesRequest message. Also converts values to other types if specified. - * @param message ListReferenceImagesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ListReferenceImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListReferenceImagesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListReferenceImagesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListReferenceImagesResponse. */ - interface IListReferenceImagesResponse { - - /** ListReferenceImagesResponse referenceImages */ - referenceImages?: (google.cloud.vision.v1p4beta1.IReferenceImage[]|null); - - /** ListReferenceImagesResponse pageSize */ - pageSize?: (number|null); - - /** ListReferenceImagesResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListReferenceImagesResponse. */ - class ListReferenceImagesResponse implements IListReferenceImagesResponse { - - /** - * Constructs a new ListReferenceImagesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IListReferenceImagesResponse); - - /** ListReferenceImagesResponse referenceImages. */ - public referenceImages: google.cloud.vision.v1p4beta1.IReferenceImage[]; - - /** ListReferenceImagesResponse pageSize. */ - public pageSize: number; - - /** ListReferenceImagesResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListReferenceImagesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListReferenceImagesResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IListReferenceImagesResponse): google.cloud.vision.v1p4beta1.ListReferenceImagesResponse; - - /** - * Encodes the specified ListReferenceImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListReferenceImagesResponse.verify|verify} messages. - * @param message ListReferenceImagesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IListReferenceImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListReferenceImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListReferenceImagesResponse.verify|verify} messages. - * @param message ListReferenceImagesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IListReferenceImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListReferenceImagesResponse - * @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.ListReferenceImagesResponse; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListReferenceImagesResponse - * @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.ListReferenceImagesResponse; - - /** - * Verifies a ListReferenceImagesResponse 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 ListReferenceImagesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListReferenceImagesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ListReferenceImagesResponse; - - /** - * Creates a plain object from a ListReferenceImagesResponse message. Also converts values to other types if specified. - * @param message ListReferenceImagesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ListReferenceImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListReferenceImagesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListReferenceImagesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetReferenceImageRequest. */ - interface IGetReferenceImageRequest { - - /** GetReferenceImageRequest name */ - name?: (string|null); - } - - /** Represents a GetReferenceImageRequest. */ - class GetReferenceImageRequest implements IGetReferenceImageRequest { - - /** - * Constructs a new GetReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IGetReferenceImageRequest); - - /** GetReferenceImageRequest name. */ - public name: string; - - /** - * Creates a new GetReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IGetReferenceImageRequest): google.cloud.vision.v1p4beta1.GetReferenceImageRequest; - - /** - * Encodes the specified GetReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetReferenceImageRequest.verify|verify} messages. - * @param message GetReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetReferenceImageRequest.verify|verify} messages. - * @param message GetReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetReferenceImageRequest - * @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.GetReferenceImageRequest; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetReferenceImageRequest - * @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.GetReferenceImageRequest; - - /** - * Verifies a GetReferenceImageRequest 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 GetReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GetReferenceImageRequest; - - /** - * Creates a plain object from a GetReferenceImageRequest message. Also converts values to other types if specified. - * @param message GetReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.GetReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteReferenceImageRequest. */ - interface IDeleteReferenceImageRequest { - - /** DeleteReferenceImageRequest name */ - name?: (string|null); - } - - /** Represents a DeleteReferenceImageRequest. */ - class DeleteReferenceImageRequest implements IDeleteReferenceImageRequest { - - /** - * Constructs a new DeleteReferenceImageRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest); - - /** DeleteReferenceImageRequest name. */ - public name: string; - - /** - * Creates a new DeleteReferenceImageRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteReferenceImageRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest): google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest; - - /** - * Encodes the specified DeleteReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest.verify|verify} messages. - * @param message DeleteReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest.verify|verify} messages. - * @param message DeleteReferenceImageRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest; - - /** - * Verifies a DeleteReferenceImageRequest 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 DeleteReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteReferenceImageRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest; - - /** - * Creates a plain object from a DeleteReferenceImageRequest message. Also converts values to other types if specified. - * @param message DeleteReferenceImageRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteReferenceImageRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteReferenceImageRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AddProductToProductSetRequest. */ - interface IAddProductToProductSetRequest { - - /** AddProductToProductSetRequest name */ - name?: (string|null); - - /** AddProductToProductSetRequest product */ - product?: (string|null); - } - - /** Represents an AddProductToProductSetRequest. */ - class AddProductToProductSetRequest implements IAddProductToProductSetRequest { - - /** - * Constructs a new AddProductToProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest); - - /** AddProductToProductSetRequest name. */ - public name: string; - - /** AddProductToProductSetRequest product. */ - public product: string; - - /** - * Creates a new AddProductToProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns AddProductToProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest): google.cloud.vision.v1p4beta1.AddProductToProductSetRequest; - - /** - * Encodes the specified AddProductToProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AddProductToProductSetRequest.verify|verify} messages. - * @param message AddProductToProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AddProductToProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AddProductToProductSetRequest.verify|verify} messages. - * @param message AddProductToProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AddProductToProductSetRequest - * @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.AddProductToProductSetRequest; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AddProductToProductSetRequest - * @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.AddProductToProductSetRequest; - - /** - * Verifies an AddProductToProductSetRequest 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 AddProductToProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AddProductToProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AddProductToProductSetRequest; - - /** - * Creates a plain object from an AddProductToProductSetRequest message. Also converts values to other types if specified. - * @param message AddProductToProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.AddProductToProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AddProductToProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AddProductToProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RemoveProductFromProductSetRequest. */ - interface IRemoveProductFromProductSetRequest { - - /** RemoveProductFromProductSetRequest name */ - name?: (string|null); - - /** RemoveProductFromProductSetRequest product */ - product?: (string|null); - } - - /** Represents a RemoveProductFromProductSetRequest. */ - class RemoveProductFromProductSetRequest implements IRemoveProductFromProductSetRequest { - - /** - * Constructs a new RemoveProductFromProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest); - - /** RemoveProductFromProductSetRequest name. */ - public name: string; - - /** RemoveProductFromProductSetRequest product. */ - public product: string; - - /** - * Creates a new RemoveProductFromProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns RemoveProductFromProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest): google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @param message RemoveProductFromProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @param message RemoveProductFromProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest; - - /** - * Verifies a RemoveProductFromProductSetRequest 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 RemoveProductFromProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RemoveProductFromProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest; - - /** - * Creates a plain object from a RemoveProductFromProductSetRequest message. Also converts values to other types if specified. - * @param message RemoveProductFromProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RemoveProductFromProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RemoveProductFromProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsInProductSetRequest. */ - interface IListProductsInProductSetRequest { - - /** ListProductsInProductSetRequest name */ - name?: (string|null); - - /** ListProductsInProductSetRequest pageSize */ - pageSize?: (number|null); - - /** ListProductsInProductSetRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListProductsInProductSetRequest. */ - class ListProductsInProductSetRequest implements IListProductsInProductSetRequest { - - /** - * Constructs a new ListProductsInProductSetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest); - - /** ListProductsInProductSetRequest name. */ - public name: string; - - /** ListProductsInProductSetRequest pageSize. */ - public pageSize: number; - - /** ListProductsInProductSetRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListProductsInProductSetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsInProductSetRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest): google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest; - - /** - * Encodes the specified ListProductsInProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest.verify|verify} messages. - * @param message ListProductsInProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsInProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest.verify|verify} messages. - * @param message ListProductsInProductSetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest; - - /** - * Verifies a ListProductsInProductSetRequest 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 ListProductsInProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsInProductSetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest; - - /** - * Creates a plain object from a ListProductsInProductSetRequest message. Also converts values to other types if specified. - * @param message ListProductsInProductSetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsInProductSetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsInProductSetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListProductsInProductSetResponse. */ - interface IListProductsInProductSetResponse { - - /** ListProductsInProductSetResponse products */ - products?: (google.cloud.vision.v1p4beta1.IProduct[]|null); - - /** ListProductsInProductSetResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListProductsInProductSetResponse. */ - class ListProductsInProductSetResponse implements IListProductsInProductSetResponse { - - /** - * Constructs a new ListProductsInProductSetResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse); - - /** ListProductsInProductSetResponse products. */ - public products: google.cloud.vision.v1p4beta1.IProduct[]; - - /** ListProductsInProductSetResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListProductsInProductSetResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListProductsInProductSetResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse): google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse; - - /** - * Encodes the specified ListProductsInProductSetResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse.verify|verify} messages. - * @param message ListProductsInProductSetResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListProductsInProductSetResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse.verify|verify} messages. - * @param message ListProductsInProductSetResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse; - - /** - * Verifies a ListProductsInProductSetResponse 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 ListProductsInProductSetResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListProductsInProductSetResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse; - - /** - * Creates a plain object from a ListProductsInProductSetResponse message. Also converts values to other types if specified. - * @param message ListProductsInProductSetResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListProductsInProductSetResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListProductsInProductSetResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsGcsSource. */ - interface IImportProductSetsGcsSource { - - /** ImportProductSetsGcsSource csvFileUri */ - csvFileUri?: (string|null); - } - - /** Represents an ImportProductSetsGcsSource. */ - class ImportProductSetsGcsSource implements IImportProductSetsGcsSource { - - /** - * Constructs a new ImportProductSetsGcsSource. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource); - - /** ImportProductSetsGcsSource csvFileUri. */ - public csvFileUri: string; - - /** - * Creates a new ImportProductSetsGcsSource instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsGcsSource instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource): google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource; - - /** - * Encodes the specified ImportProductSetsGcsSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.verify|verify} messages. - * @param message ImportProductSetsGcsSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsGcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.verify|verify} messages. - * @param message ImportProductSetsGcsSource message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource; - - /** - * Verifies an ImportProductSetsGcsSource 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 ImportProductSetsGcsSource message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsGcsSource - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource; - - /** - * Creates a plain object from an ImportProductSetsGcsSource message. Also converts values to other types if specified. - * @param message ImportProductSetsGcsSource - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsGcsSource to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsGcsSource - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsInputConfig. */ - interface IImportProductSetsInputConfig { - - /** ImportProductSetsInputConfig gcsSource */ - gcsSource?: (google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource|null); - } - - /** Represents an ImportProductSetsInputConfig. */ - class ImportProductSetsInputConfig implements IImportProductSetsInputConfig { - - /** - * Constructs a new ImportProductSetsInputConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig); - - /** ImportProductSetsInputConfig gcsSource. */ - public gcsSource?: (google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource|null); - - /** ImportProductSetsInputConfig source. */ - public source?: "gcsSource"; - - /** - * Creates a new ImportProductSetsInputConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsInputConfig instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig): google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig; - - /** - * Encodes the specified ImportProductSetsInputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.verify|verify} messages. - * @param message ImportProductSetsInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsInputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.verify|verify} messages. - * @param message ImportProductSetsInputConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig; - - /** - * Verifies an ImportProductSetsInputConfig 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 ImportProductSetsInputConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsInputConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig; - - /** - * Creates a plain object from an ImportProductSetsInputConfig message. Also converts values to other types if specified. - * @param message ImportProductSetsInputConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsInputConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsInputConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsRequest. */ - interface IImportProductSetsRequest { - - /** ImportProductSetsRequest parent */ - parent?: (string|null); - - /** ImportProductSetsRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig|null); - } - - /** Represents an ImportProductSetsRequest. */ - class ImportProductSetsRequest implements IImportProductSetsRequest { - - /** - * Constructs a new ImportProductSetsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImportProductSetsRequest); - - /** ImportProductSetsRequest parent. */ - public parent: string; - - /** ImportProductSetsRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig|null); - - /** - * Creates a new ImportProductSetsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImportProductSetsRequest): google.cloud.vision.v1p4beta1.ImportProductSetsRequest; - - /** - * Encodes the specified ImportProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsRequest.verify|verify} messages. - * @param message ImportProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IImportProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsRequest.verify|verify} messages. - * @param message ImportProductSetsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImportProductSetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsRequest - * @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.ImportProductSetsRequest; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsRequest - * @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.ImportProductSetsRequest; - - /** - * Verifies an ImportProductSetsRequest 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 ImportProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImportProductSetsRequest; - - /** - * Creates a plain object from an ImportProductSetsRequest message. Also converts values to other types if specified. - * @param message ImportProductSetsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ImportProductSetsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportProductSetsResponse. */ - interface IImportProductSetsResponse { - - /** ImportProductSetsResponse referenceImages */ - referenceImages?: (google.cloud.vision.v1p4beta1.IReferenceImage[]|null); - - /** ImportProductSetsResponse statuses */ - statuses?: (google.rpc.IStatus[]|null); - } - - /** Represents an ImportProductSetsResponse. */ - class ImportProductSetsResponse implements IImportProductSetsResponse { - - /** - * Constructs a new ImportProductSetsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImportProductSetsResponse); - - /** ImportProductSetsResponse referenceImages. */ - public referenceImages: google.cloud.vision.v1p4beta1.IReferenceImage[]; - - /** ImportProductSetsResponse statuses. */ - public statuses: google.rpc.IStatus[]; - - /** - * Creates a new ImportProductSetsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportProductSetsResponse instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImportProductSetsResponse): google.cloud.vision.v1p4beta1.ImportProductSetsResponse; - - /** - * Encodes the specified ImportProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsResponse.verify|verify} messages. - * @param message ImportProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IImportProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsResponse.verify|verify} messages. - * @param message ImportProductSetsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImportProductSetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportProductSetsResponse - * @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.ImportProductSetsResponse; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportProductSetsResponse - * @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.ImportProductSetsResponse; - - /** - * Verifies an ImportProductSetsResponse 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 ImportProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportProductSetsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImportProductSetsResponse; - - /** - * Creates a plain object from an ImportProductSetsResponse message. Also converts values to other types if specified. - * @param message ImportProductSetsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ImportProductSetsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportProductSetsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportProductSetsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BatchOperationMetadata. */ - interface IBatchOperationMetadata { - - /** BatchOperationMetadata state */ - state?: (google.cloud.vision.v1p4beta1.BatchOperationMetadata.State|keyof typeof google.cloud.vision.v1p4beta1.BatchOperationMetadata.State|null); - - /** BatchOperationMetadata submitTime */ - submitTime?: (google.protobuf.ITimestamp|null); - - /** BatchOperationMetadata endTime */ - endTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a BatchOperationMetadata. */ - class BatchOperationMetadata implements IBatchOperationMetadata { - - /** - * Constructs a new BatchOperationMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchOperationMetadata); - - /** BatchOperationMetadata state. */ - public state: (google.cloud.vision.v1p4beta1.BatchOperationMetadata.State|keyof typeof google.cloud.vision.v1p4beta1.BatchOperationMetadata.State); - - /** BatchOperationMetadata submitTime. */ - public submitTime?: (google.protobuf.ITimestamp|null); - - /** BatchOperationMetadata endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new BatchOperationMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchOperationMetadata instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchOperationMetadata): google.cloud.vision.v1p4beta1.BatchOperationMetadata; - - /** - * Encodes the specified BatchOperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchOperationMetadata.verify|verify} messages. - * @param message BatchOperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IBatchOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchOperationMetadata.verify|verify} messages. - * @param message BatchOperationMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BatchOperationMetadata - * @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.BatchOperationMetadata; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BatchOperationMetadata - * @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.BatchOperationMetadata; - - /** - * Verifies a BatchOperationMetadata 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 BatchOperationMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchOperationMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchOperationMetadata; - - /** - * Creates a plain object from a BatchOperationMetadata message. Also converts values to other types if specified. - * @param message BatchOperationMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.BatchOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchOperationMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BatchOperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BatchOperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - PROCESSING = 1, - SUCCESSFUL = 2, - FAILED = 3, - CANCELLED = 4 - } - } - - /** Properties of a ProductSetPurgeConfig. */ - interface IProductSetPurgeConfig { - - /** ProductSetPurgeConfig productSetId */ - productSetId?: (string|null); - } - - /** Represents a ProductSetPurgeConfig. */ - class ProductSetPurgeConfig implements IProductSetPurgeConfig { - - /** - * Constructs a new ProductSetPurgeConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IProductSetPurgeConfig); - - /** ProductSetPurgeConfig productSetId. */ - public productSetId: string; - - /** - * Creates a new ProductSetPurgeConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ProductSetPurgeConfig instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IProductSetPurgeConfig): google.cloud.vision.v1p4beta1.ProductSetPurgeConfig; - - /** - * Encodes the specified ProductSetPurgeConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.verify|verify} messages. - * @param message ProductSetPurgeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IProductSetPurgeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ProductSetPurgeConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.verify|verify} messages. - * @param message ProductSetPurgeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IProductSetPurgeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ProductSetPurgeConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProductSetPurgeConfig - * @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.ProductSetPurgeConfig; - - /** - * Decodes a ProductSetPurgeConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProductSetPurgeConfig - * @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.ProductSetPurgeConfig; - - /** - * Verifies a ProductSetPurgeConfig 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 ProductSetPurgeConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProductSetPurgeConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ProductSetPurgeConfig; - - /** - * Creates a plain object from a ProductSetPurgeConfig message. Also converts values to other types if specified. - * @param message ProductSetPurgeConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ProductSetPurgeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ProductSetPurgeConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ProductSetPurgeConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PurgeProductsRequest. */ - interface IPurgeProductsRequest { - - /** PurgeProductsRequest productSetPurgeConfig */ - productSetPurgeConfig?: (google.cloud.vision.v1p4beta1.IProductSetPurgeConfig|null); - - /** PurgeProductsRequest deleteOrphanProducts */ - deleteOrphanProducts?: (boolean|null); - - /** PurgeProductsRequest parent */ - parent?: (string|null); - - /** PurgeProductsRequest force */ - force?: (boolean|null); - } - - /** Represents a PurgeProductsRequest. */ - class PurgeProductsRequest implements IPurgeProductsRequest { - - /** - * Constructs a new PurgeProductsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IPurgeProductsRequest); - - /** PurgeProductsRequest productSetPurgeConfig. */ - public productSetPurgeConfig?: (google.cloud.vision.v1p4beta1.IProductSetPurgeConfig|null); - - /** PurgeProductsRequest deleteOrphanProducts. */ - public deleteOrphanProducts?: (boolean|null); - - /** PurgeProductsRequest parent. */ - public parent: string; - - /** PurgeProductsRequest force. */ - public force: boolean; - - /** PurgeProductsRequest target. */ - public target?: ("productSetPurgeConfig"|"deleteOrphanProducts"); - - /** - * Creates a new PurgeProductsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns PurgeProductsRequest instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IPurgeProductsRequest): google.cloud.vision.v1p4beta1.PurgeProductsRequest; - - /** - * Encodes the specified PurgeProductsRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.PurgeProductsRequest.verify|verify} messages. - * @param message PurgeProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IPurgeProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PurgeProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.PurgeProductsRequest.verify|verify} messages. - * @param message PurgeProductsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IPurgeProductsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PurgeProductsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PurgeProductsRequest - * @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.PurgeProductsRequest; - - /** - * Decodes a PurgeProductsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PurgeProductsRequest - * @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.PurgeProductsRequest; - - /** - * Verifies a PurgeProductsRequest 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 PurgeProductsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PurgeProductsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.PurgeProductsRequest; - - /** - * Creates a plain object from a PurgeProductsRequest message. Also converts values to other types if specified. - * @param message PurgeProductsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.PurgeProductsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PurgeProductsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PurgeProductsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TextAnnotation. */ - interface ITextAnnotation { - - /** TextAnnotation pages */ - pages?: (google.cloud.vision.v1p4beta1.IPage[]|null); - - /** TextAnnotation text */ - text?: (string|null); - } - - /** Represents a TextAnnotation. */ - class TextAnnotation implements ITextAnnotation { - - /** - * Constructs a new TextAnnotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ITextAnnotation); - - /** TextAnnotation pages. */ - public pages: google.cloud.vision.v1p4beta1.IPage[]; - - /** TextAnnotation text. */ - public text: string; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns TextAnnotation instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ITextAnnotation): google.cloud.vision.v1p4beta1.TextAnnotation; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.verify|verify} messages. - * @param message TextAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ITextAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextAnnotation - * @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.TextAnnotation; - - /** - * Verifies a TextAnnotation 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 TextAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextAnnotation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.TextAnnotation; - - /** - * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. - * @param message TextAnnotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.TextAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextAnnotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextAnnotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace TextAnnotation { - - /** Properties of a DetectedLanguage. */ - interface IDetectedLanguage { - - /** DetectedLanguage languageCode */ - languageCode?: (string|null); - - /** DetectedLanguage confidence */ - confidence?: (number|null); - } - - /** Represents a DetectedLanguage. */ - class DetectedLanguage implements IDetectedLanguage { - - /** - * Constructs a new DetectedLanguage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedLanguage); - - /** DetectedLanguage languageCode. */ - public languageCode: string; - - /** DetectedLanguage confidence. */ - public confidence: number; - - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedLanguage instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedLanguage): google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage; - - /** - * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @param message DetectedLanguage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedLanguage - * @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.TextAnnotation.DetectedLanguage; - - /** - * Verifies a DetectedLanguage 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 DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedLanguage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @param message DetectedLanguage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedLanguage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedLanguage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DetectedBreak. */ - interface IDetectedBreak { - - /** DetectedBreak type */ - type?: (google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.BreakType|null); - - /** DetectedBreak isPrefix */ - isPrefix?: (boolean|null); - } - - /** Represents a DetectedBreak. */ - class DetectedBreak implements IDetectedBreak { - - /** - * Constructs a new DetectedBreak. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak); - - /** DetectedBreak type. */ - public type: (google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.BreakType|keyof typeof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.BreakType); - - /** DetectedBreak isPrefix. */ - public isPrefix: boolean; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @param [properties] Properties to set - * @returns DetectedBreak instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak): google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @param message DetectedBreak message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DetectedBreak - * @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.TextAnnotation.DetectedBreak; - - /** - * Verifies a DetectedBreak 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 DetectedBreak message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DetectedBreak - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak; - - /** - * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. - * @param message DetectedBreak - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DetectedBreak to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DetectedBreak - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DetectedBreak { - - /** BreakType enum. */ - enum BreakType { - UNKNOWN = 0, - SPACE = 1, - SURE_SPACE = 2, - EOL_SURE_SPACE = 3, - HYPHEN = 4, - LINE_BREAK = 5 - } - } - - /** Properties of a TextProperty. */ - interface ITextProperty { - - /** TextProperty detectedLanguages */ - detectedLanguages?: (google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedLanguage[]|null); - - /** TextProperty detectedBreak */ - detectedBreak?: (google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak|null); - } - - /** Represents a TextProperty. */ - class TextProperty implements ITextProperty { - - /** - * Constructs a new TextProperty. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty); - - /** TextProperty detectedLanguages. */ - public detectedLanguages: google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedLanguage[]; - - /** TextProperty detectedBreak. */ - public detectedBreak?: (google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak|null); - - /** - * Creates a new TextProperty instance using the specified properties. - * @param [properties] Properties to set - * @returns TextProperty instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty): google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty; - - /** - * Encodes the specified TextProperty message. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TextProperty message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @param message TextProperty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TextProperty message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Decodes a TextProperty message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TextProperty - * @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.TextAnnotation.TextProperty; - - /** - * Verifies a TextProperty 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 TextProperty message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TextProperty - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty; - - /** - * Creates a plain object from a TextProperty message. Also converts values to other types if specified. - * @param message TextProperty - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TextProperty to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TextProperty - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a Page. */ - interface IPage { - - /** Page property */ - property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Page width */ - width?: (number|null); - - /** Page height */ - height?: (number|null); - - /** Page blocks */ - blocks?: (google.cloud.vision.v1p4beta1.IBlock[]|null); - - /** Page confidence */ - confidence?: (number|null); - } - - /** Represents a Page. */ - class Page implements IPage { - - /** - * Constructs a new Page. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IPage); - - /** Page property. */ - public property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Page width. */ - public width: number; - - /** Page height. */ - public height: number; - - /** Page blocks. */ - public blocks: google.cloud.vision.v1p4beta1.IBlock[]; - - /** Page confidence. */ - public confidence: number; - - /** - * Creates a new Page instance using the specified properties. - * @param [properties] Properties to set - * @returns Page instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IPage): google.cloud.vision.v1p4beta1.Page; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Page.verify|verify} messages. - * @param message Page message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Page message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Page - * @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.Page; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Page - * @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.Page; - - /** - * Verifies a Page 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 Page message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Page - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Page; - - /** - * Creates a plain object from a Page message. Also converts values to other types if specified. - * @param message Page - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Page to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Page - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Block. */ - interface IBlock { - - /** Block property */ - property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox */ - boundingBox?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** Block paragraphs */ - paragraphs?: (google.cloud.vision.v1p4beta1.IParagraph[]|null); - - /** Block blockType */ - blockType?: (google.cloud.vision.v1p4beta1.Block.BlockType|keyof typeof google.cloud.vision.v1p4beta1.Block.BlockType|null); - - /** Block confidence */ - confidence?: (number|null); - } - - /** Represents a Block. */ - class Block implements IBlock { - - /** - * Constructs a new Block. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBlock); - - /** Block property. */ - public property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Block boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** Block paragraphs. */ - public paragraphs: google.cloud.vision.v1p4beta1.IParagraph[]; - - /** Block blockType. */ - public blockType: (google.cloud.vision.v1p4beta1.Block.BlockType|keyof typeof google.cloud.vision.v1p4beta1.Block.BlockType); - - /** Block confidence. */ - public confidence: number; - - /** - * Creates a new Block instance using the specified properties. - * @param [properties] Properties to set - * @returns Block instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBlock): google.cloud.vision.v1p4beta1.Block; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Block.verify|verify} messages. - * @param message Block message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBlock, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Block message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Block - * @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.Block; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Block - * @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.Block; - - /** - * Verifies a Block 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 Block message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Block - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Block; - - /** - * Creates a plain object from a Block message. Also converts values to other types if specified. - * @param message Block - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.Block, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Block to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Block - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Block { - - /** BlockType enum. */ - enum BlockType { - UNKNOWN = 0, - TEXT = 1, - TABLE = 2, - PICTURE = 3, - RULER = 4, - BARCODE = 5 - } - } - - /** Properties of a Paragraph. */ - interface IParagraph { - - /** Paragraph property */ - property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox */ - boundingBox?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** Paragraph words */ - words?: (google.cloud.vision.v1p4beta1.IWord[]|null); - - /** Paragraph confidence */ - confidence?: (number|null); - } - - /** Represents a Paragraph. */ - class Paragraph implements IParagraph { - - /** - * Constructs a new Paragraph. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IParagraph); - - /** Paragraph property. */ - public property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Paragraph boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** Paragraph words. */ - public words: google.cloud.vision.v1p4beta1.IWord[]; - - /** Paragraph confidence. */ - public confidence: number; - - /** - * Creates a new Paragraph instance using the specified properties. - * @param [properties] Properties to set - * @returns Paragraph instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IParagraph): google.cloud.vision.v1p4beta1.Paragraph; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Paragraph.verify|verify} messages. - * @param message Paragraph message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IParagraph, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Paragraph message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Paragraph - * @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.Paragraph; - - /** - * Decodes a Paragraph message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Paragraph - * @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.Paragraph; - - /** - * Verifies a Paragraph 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 Paragraph message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Paragraph - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Paragraph; - - /** - * Creates a plain object from a Paragraph message. Also converts values to other types if specified. - * @param message Paragraph - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.Paragraph, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Paragraph to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Paragraph - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Word. */ - interface IWord { - - /** Word property */ - property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox */ - boundingBox?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** Word symbols */ - symbols?: (google.cloud.vision.v1p4beta1.ISymbol[]|null); - - /** Word confidence */ - confidence?: (number|null); - } - - /** Represents a Word. */ - class Word implements IWord { - - /** - * Constructs a new Word. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IWord); - - /** Word property. */ - public property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Word boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** Word symbols. */ - public symbols: google.cloud.vision.v1p4beta1.ISymbol[]; - - /** Word confidence. */ - public confidence: number; - - /** - * Creates a new Word instance using the specified properties. - * @param [properties] Properties to set - * @returns Word instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IWord): google.cloud.vision.v1p4beta1.Word; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Word message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Word.verify|verify} messages. - * @param message Word message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IWord, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Word message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Word - * @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.Word; - - /** - * Decodes a Word message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Word - * @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.Word; - - /** - * Verifies a Word 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 Word message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Word - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Word; - - /** - * Creates a plain object from a Word message. Also converts values to other types if specified. - * @param message Word - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.Word, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Word to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Word - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Symbol. */ - interface ISymbol { - - /** Symbol property */ - property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox */ - boundingBox?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** Symbol text */ - text?: (string|null); - - /** Symbol confidence */ - confidence?: (number|null); - } - - /** Represents a Symbol. */ - class Symbol implements ISymbol { - - /** - * Constructs a new Symbol. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.ISymbol); - - /** Symbol property. */ - public property?: (google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null); - - /** Symbol boundingBox. */ - public boundingBox?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** Symbol text. */ - public text: string; - - /** Symbol confidence. */ - public confidence: number; - - /** - * Creates a new Symbol instance using the specified properties. - * @param [properties] Properties to set - * @returns Symbol instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.ISymbol): google.cloud.vision.v1p4beta1.Symbol; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Symbol.verify|verify} messages. - * @param message Symbol message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Symbol message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.Symbol; - - /** - * Decodes a Symbol message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Symbol - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.Symbol; - - /** - * Verifies a Symbol message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Symbol message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Symbol - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Symbol; - - /** - * Creates a plain object from a Symbol message. Also converts values to other types if specified. - * @param message Symbol - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Symbol to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Symbol - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebDetection. */ - interface IWebDetection { - - /** WebDetection webEntities */ - webEntities?: (google.cloud.vision.v1p4beta1.WebDetection.IWebEntity[]|null); - - /** WebDetection fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]|null); - - /** WebDetection partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]|null); - - /** WebDetection pagesWithMatchingImages */ - pagesWithMatchingImages?: (google.cloud.vision.v1p4beta1.WebDetection.IWebPage[]|null); - - /** WebDetection visuallySimilarImages */ - visuallySimilarImages?: (google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]|null); - - /** WebDetection bestGuessLabels */ - bestGuessLabels?: (google.cloud.vision.v1p4beta1.WebDetection.IWebLabel[]|null); - } - - /** Represents a WebDetection. */ - class WebDetection implements IWebDetection { - - /** - * Constructs a new WebDetection. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.IWebDetection); - - /** WebDetection webEntities. */ - public webEntities: google.cloud.vision.v1p4beta1.WebDetection.IWebEntity[]; - - /** WebDetection fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]; - - /** WebDetection partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]; - - /** WebDetection pagesWithMatchingImages. */ - public pagesWithMatchingImages: google.cloud.vision.v1p4beta1.WebDetection.IWebPage[]; - - /** WebDetection visuallySimilarImages. */ - public visuallySimilarImages: google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]; - - /** WebDetection bestGuessLabels. */ - public bestGuessLabels: google.cloud.vision.v1p4beta1.WebDetection.IWebLabel[]; - - /** - * Creates a new WebDetection instance using the specified properties. - * @param [properties] Properties to set - * @returns WebDetection instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.IWebDetection): google.cloud.vision.v1p4beta1.WebDetection; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebDetection message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.verify|verify} messages. - * @param message WebDetection message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IWebDetection, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebDetection message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebDetection - * @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.WebDetection; - - /** - * Decodes a WebDetection message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebDetection - * @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.WebDetection; - - /** - * Verifies a WebDetection 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 WebDetection message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebDetection - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.WebDetection; - - /** - * Creates a plain object from a WebDetection message. Also converts values to other types if specified. - * @param message WebDetection - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.WebDetection, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebDetection to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebDetection - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace WebDetection { - - /** Properties of a WebEntity. */ - interface IWebEntity { - - /** WebEntity entityId */ - entityId?: (string|null); - - /** WebEntity score */ - score?: (number|null); - - /** WebEntity description */ - description?: (string|null); - } - - /** Represents a WebEntity. */ - class WebEntity implements IWebEntity { - - /** - * Constructs a new WebEntity. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.WebDetection.IWebEntity); - - /** WebEntity entityId. */ - public entityId: string; - - /** WebEntity score. */ - public score: number; - - /** WebEntity description. */ - public description: string; - - /** - * Creates a new WebEntity instance using the specified properties. - * @param [properties] Properties to set - * @returns WebEntity instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.WebDetection.IWebEntity): google.cloud.vision.v1p4beta1.WebDetection.WebEntity; - - /** - * Encodes the specified WebEntity message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebEntity.verify|verify} messages. - * @param message WebEntity message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.WebDetection.IWebEntity, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebEntity - * @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.WebDetection.WebEntity; - - /** - * Verifies a WebEntity 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 WebEntity message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebEntity - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.WebDetection.WebEntity; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @param message WebEntity - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.WebDetection.WebEntity, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebEntity to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebEntity - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebImage. */ - interface IWebImage { - - /** WebImage url */ - url?: (string|null); - - /** WebImage score */ - score?: (number|null); - } - - /** Represents a WebImage. */ - class WebImage implements IWebImage { - - /** - * Constructs a new WebImage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.WebDetection.IWebImage); - - /** WebImage url. */ - public url: string; - - /** WebImage score. */ - public score: number; - - /** - * Creates a new WebImage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebImage instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.WebDetection.IWebImage): google.cloud.vision.v1p4beta1.WebDetection.WebImage; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebImage.verify|verify} messages. - * @param message WebImage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.WebDetection.IWebImage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebImage - * @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.WebDetection.WebImage; - - /** - * Verifies a WebImage 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 WebImage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebImage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.WebDetection.WebImage; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @param message WebImage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.WebDetection.WebImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebImage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebImage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebPage. */ - interface IWebPage { - - /** WebPage url */ - url?: (string|null); - - /** WebPage score */ - score?: (number|null); - - /** WebPage pageTitle */ - pageTitle?: (string|null); - - /** WebPage fullMatchingImages */ - fullMatchingImages?: (google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]|null); - - /** WebPage partialMatchingImages */ - partialMatchingImages?: (google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]|null); - } - - /** Represents a WebPage. */ - class WebPage implements IWebPage { - - /** - * Constructs a new WebPage. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.WebDetection.IWebPage); - - /** WebPage url. */ - public url: string; - - /** WebPage score. */ - public score: number; - - /** WebPage pageTitle. */ - public pageTitle: string; - - /** WebPage fullMatchingImages. */ - public fullMatchingImages: google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]; - - /** WebPage partialMatchingImages. */ - public partialMatchingImages: google.cloud.vision.v1p4beta1.WebDetection.IWebImage[]; - - /** - * Creates a new WebPage instance using the specified properties. - * @param [properties] Properties to set - * @returns WebPage instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.WebDetection.IWebPage): google.cloud.vision.v1p4beta1.WebDetection.WebPage; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebPage.verify|verify} messages. - * @param message WebPage message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.WebDetection.IWebPage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebPage - * @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.WebDetection.WebPage; - - /** - * Verifies a WebPage 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 WebPage message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebPage - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.WebDetection.WebPage; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @param message WebPage - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.WebDetection.WebPage, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebPage to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebPage - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WebLabel. */ - interface IWebLabel { - - /** WebLabel label */ - label?: (string|null); - - /** WebLabel languageCode */ - languageCode?: (string|null); - } - - /** Represents a WebLabel. */ - class WebLabel implements IWebLabel { - - /** - * Constructs a new WebLabel. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.WebDetection.IWebLabel); - - /** WebLabel label. */ - public label: string; - - /** WebLabel languageCode. */ - public languageCode: string; - - /** - * Creates a new WebLabel instance using the specified properties. - * @param [properties] Properties to set - * @returns WebLabel instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.WebDetection.IWebLabel): google.cloud.vision.v1p4beta1.WebDetection.WebLabel; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebLabel.verify|verify} messages. - * @param message WebLabel message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.WebDetection.IWebLabel, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WebLabel - * @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.WebDetection.WebLabel; - - /** - * Verifies a WebLabel 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 WebLabel message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WebLabel - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.WebDetection.WebLabel; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @param message WebLabel - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.WebDetection.WebLabel, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WebLabel to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WebLabel - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - } - } - - /** Namespace api. */ - namespace api { - - /** Properties of a Http. */ - interface IHttp { - - /** Http rules */ - rules?: (google.api.IHttpRule[]|null); - - /** Http fullyDecodeReservedExpansion */ - fullyDecodeReservedExpansion?: (boolean|null); - } - - /** Represents a Http. */ - class Http implements IHttp { - - /** - * Constructs a new Http. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IHttp); - - /** Http rules. */ - public rules: google.api.IHttpRule[]; - - /** Http fullyDecodeReservedExpansion. */ - public fullyDecodeReservedExpansion: boolean; - - /** - * Creates a new Http instance using the specified properties. - * @param [properties] Properties to set - * @returns Http instance - */ - public static create(properties?: google.api.IHttp): google.api.Http; - - /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @param message Http message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @param message Http message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Http message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Http - * @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.api.Http; - - /** - * Decodes a Http message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Http - * @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.api.Http; - - /** - * Verifies a Http 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 Http message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Http - */ - public static fromObject(object: { [k: string]: any }): google.api.Http; - - /** - * Creates a plain object from a Http message. Also converts values to other types if specified. - * @param message Http - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Http to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Http - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a HttpRule. */ - interface IHttpRule { - - /** HttpRule selector */ - selector?: (string|null); - - /** HttpRule get */ - get?: (string|null); - - /** HttpRule put */ - put?: (string|null); - - /** HttpRule post */ - post?: (string|null); - - /** HttpRule delete */ - "delete"?: (string|null); - - /** HttpRule patch */ - patch?: (string|null); - - /** HttpRule custom */ - custom?: (google.api.ICustomHttpPattern|null); - - /** HttpRule body */ - body?: (string|null); - - /** HttpRule responseBody */ - responseBody?: (string|null); - - /** HttpRule additionalBindings */ - additionalBindings?: (google.api.IHttpRule[]|null); - } - - /** Represents a HttpRule. */ - class HttpRule implements IHttpRule { - - /** - * Constructs a new HttpRule. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IHttpRule); - - /** HttpRule selector. */ - public selector: string; - - /** HttpRule get. */ - public get?: (string|null); - - /** HttpRule put. */ - public put?: (string|null); - - /** HttpRule post. */ - public post?: (string|null); - - /** HttpRule delete. */ - public delete?: (string|null); - - /** HttpRule patch. */ - public patch?: (string|null); - - /** HttpRule custom. */ - public custom?: (google.api.ICustomHttpPattern|null); - - /** HttpRule body. */ - public body: string; - - /** HttpRule responseBody. */ - public responseBody: string; - - /** HttpRule additionalBindings. */ - public additionalBindings: google.api.IHttpRule[]; - - /** HttpRule pattern. */ - public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); - - /** - * Creates a new HttpRule instance using the specified properties. - * @param [properties] Properties to set - * @returns HttpRule instance - */ - public static create(properties?: google.api.IHttpRule): google.api.HttpRule; - - /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @param message HttpRule message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @param message HttpRule message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a HttpRule message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns HttpRule - * @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.api.HttpRule; - - /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns HttpRule - * @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.api.HttpRule; - - /** - * Verifies a HttpRule 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 HttpRule message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns HttpRule - */ - public static fromObject(object: { [k: string]: any }): google.api.HttpRule; - - /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. - * @param message HttpRule - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this HttpRule to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for HttpRule - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CustomHttpPattern. */ - interface ICustomHttpPattern { - - /** CustomHttpPattern kind */ - kind?: (string|null); - - /** CustomHttpPattern path */ - path?: (string|null); - } - - /** Represents a CustomHttpPattern. */ - class CustomHttpPattern implements ICustomHttpPattern { - - /** - * Constructs a new CustomHttpPattern. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.ICustomHttpPattern); - - /** CustomHttpPattern kind. */ - public kind: string; - - /** CustomHttpPattern path. */ - public path: string; - - /** - * Creates a new CustomHttpPattern instance using the specified properties. - * @param [properties] Properties to set - * @returns CustomHttpPattern instance - */ - public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; - - /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @param message CustomHttpPattern message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @param message CustomHttpPattern message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CustomHttpPattern - * @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.api.CustomHttpPattern; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CustomHttpPattern - * @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.api.CustomHttpPattern; - - /** - * Verifies a CustomHttpPattern 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 CustomHttpPattern message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CustomHttpPattern - */ - public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; - - /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. - * @param message CustomHttpPattern - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CustomHttpPattern to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CustomHttpPattern - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** FieldBehavior enum. */ - enum FieldBehavior { - FIELD_BEHAVIOR_UNSPECIFIED = 0, - OPTIONAL = 1, - REQUIRED = 2, - OUTPUT_ONLY = 3, - INPUT_ONLY = 4, - IMMUTABLE = 5, - UNORDERED_LIST = 6, - NON_EMPTY_DEFAULT = 7 - } - - /** Properties of a ResourceDescriptor. */ - interface IResourceDescriptor { - - /** ResourceDescriptor type */ - type?: (string|null); - - /** ResourceDescriptor pattern */ - pattern?: (string[]|null); - - /** ResourceDescriptor nameField */ - nameField?: (string|null); - - /** ResourceDescriptor history */ - history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); - - /** ResourceDescriptor plural */ - plural?: (string|null); - - /** ResourceDescriptor singular */ - singular?: (string|null); - - /** ResourceDescriptor style */ - style?: (google.api.ResourceDescriptor.Style[]|null); - } - - /** Represents a ResourceDescriptor. */ - class ResourceDescriptor implements IResourceDescriptor { - - /** - * Constructs a new ResourceDescriptor. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IResourceDescriptor); - - /** ResourceDescriptor type. */ - public type: string; - - /** ResourceDescriptor pattern. */ - public pattern: string[]; - - /** ResourceDescriptor nameField. */ - public nameField: string; - - /** ResourceDescriptor history. */ - public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); - - /** ResourceDescriptor plural. */ - public plural: string; - - /** ResourceDescriptor singular. */ - public singular: string; - - /** ResourceDescriptor style. */ - public style: google.api.ResourceDescriptor.Style[]; - - /** - * Creates a new ResourceDescriptor instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceDescriptor instance - */ - public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; - - /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @param message ResourceDescriptor message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @param message ResourceDescriptor message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceDescriptor - * @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.api.ResourceDescriptor; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceDescriptor - * @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.api.ResourceDescriptor; - - /** - * Verifies a ResourceDescriptor 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 ResourceDescriptor message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceDescriptor - */ - public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; - - /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. - * @param message ResourceDescriptor - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceDescriptor to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceDescriptor - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ResourceDescriptor { - - /** History enum. */ - enum History { - HISTORY_UNSPECIFIED = 0, - ORIGINALLY_SINGLE_PATTERN = 1, - FUTURE_MULTI_PATTERN = 2 - } - - /** Style enum. */ - enum Style { - STYLE_UNSPECIFIED = 0, - DECLARATIVE_FRIENDLY = 1 - } - } - - /** Properties of a ResourceReference. */ - interface IResourceReference { - - /** ResourceReference type */ - type?: (string|null); - - /** ResourceReference childType */ - childType?: (string|null); - } - - /** Represents a ResourceReference. */ - class ResourceReference implements IResourceReference { - - /** - * Constructs a new ResourceReference. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IResourceReference); - - /** ResourceReference type. */ - public type: string; - - /** ResourceReference childType. */ - public childType: string; - - /** - * Creates a new ResourceReference instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceReference instance - */ - public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; - - /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @param message ResourceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @param message ResourceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceReference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceReference - * @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.api.ResourceReference; - - /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceReference - * @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.api.ResourceReference; - - /** - * Verifies a ResourceReference 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 ResourceReference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceReference - */ - public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; - - /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. - * @param message ResourceReference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceReference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceReference - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace protobuf. */ - namespace protobuf { - - /** Properties of a FileDescriptorSet. */ - interface IFileDescriptorSet { - - /** FileDescriptorSet file */ - file?: (google.protobuf.IFileDescriptorProto[]|null); - } - - /** Represents a FileDescriptorSet. */ - class FileDescriptorSet implements IFileDescriptorSet { - - /** - * Constructs a new FileDescriptorSet. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFileDescriptorSet); - - /** FileDescriptorSet file. */ - public file: google.protobuf.IFileDescriptorProto[]; - - /** - * Creates a new FileDescriptorSet instance using the specified properties. - * @param [properties] Properties to set - * @returns FileDescriptorSet instance - */ - public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; - - /** - * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @param message FileDescriptorSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @param message FileDescriptorSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FileDescriptorSet - * @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.protobuf.FileDescriptorSet; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FileDescriptorSet - * @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.protobuf.FileDescriptorSet; - - /** - * Verifies a FileDescriptorSet 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 FileDescriptorSet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FileDescriptorSet - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; - - /** - * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. - * @param message FileDescriptorSet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FileDescriptorSet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FileDescriptorSet - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FileDescriptorProto. */ - interface IFileDescriptorProto { - - /** FileDescriptorProto name */ - name?: (string|null); - - /** FileDescriptorProto package */ - "package"?: (string|null); - - /** FileDescriptorProto dependency */ - dependency?: (string[]|null); - - /** FileDescriptorProto publicDependency */ - publicDependency?: (number[]|null); - - /** FileDescriptorProto weakDependency */ - weakDependency?: (number[]|null); - - /** FileDescriptorProto messageType */ - messageType?: (google.protobuf.IDescriptorProto[]|null); - - /** FileDescriptorProto enumType */ - enumType?: (google.protobuf.IEnumDescriptorProto[]|null); - - /** FileDescriptorProto service */ - service?: (google.protobuf.IServiceDescriptorProto[]|null); - - /** FileDescriptorProto extension */ - extension?: (google.protobuf.IFieldDescriptorProto[]|null); - - /** FileDescriptorProto options */ - options?: (google.protobuf.IFileOptions|null); - - /** FileDescriptorProto sourceCodeInfo */ - sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); - - /** FileDescriptorProto syntax */ - syntax?: (string|null); - - /** FileDescriptorProto edition */ - edition?: (string|null); - } - - /** Represents a FileDescriptorProto. */ - class FileDescriptorProto implements IFileDescriptorProto { - - /** - * Constructs a new FileDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFileDescriptorProto); - - /** FileDescriptorProto name. */ - public name: string; - - /** FileDescriptorProto package. */ - public package: string; - - /** FileDescriptorProto dependency. */ - public dependency: string[]; - - /** FileDescriptorProto publicDependency. */ - public publicDependency: number[]; - - /** FileDescriptorProto weakDependency. */ - public weakDependency: number[]; - - /** FileDescriptorProto messageType. */ - public messageType: google.protobuf.IDescriptorProto[]; - - /** FileDescriptorProto enumType. */ - public enumType: google.protobuf.IEnumDescriptorProto[]; - - /** FileDescriptorProto service. */ - public service: google.protobuf.IServiceDescriptorProto[]; - - /** FileDescriptorProto extension. */ - public extension: google.protobuf.IFieldDescriptorProto[]; - - /** FileDescriptorProto options. */ - public options?: (google.protobuf.IFileOptions|null); - - /** FileDescriptorProto sourceCodeInfo. */ - public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); - - /** FileDescriptorProto syntax. */ - public syntax: string; - - /** FileDescriptorProto edition. */ - public edition: string; - - /** - * Creates a new FileDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns FileDescriptorProto instance - */ - public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; - - /** - * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @param message FileDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @param message FileDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FileDescriptorProto - * @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.protobuf.FileDescriptorProto; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FileDescriptorProto - * @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.protobuf.FileDescriptorProto; - - /** - * Verifies a FileDescriptorProto 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 FileDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FileDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; - - /** - * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. - * @param message FileDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FileDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FileDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DescriptorProto. */ - interface IDescriptorProto { - - /** DescriptorProto name */ - name?: (string|null); - - /** DescriptorProto field */ - field?: (google.protobuf.IFieldDescriptorProto[]|null); - - /** DescriptorProto extension */ - extension?: (google.protobuf.IFieldDescriptorProto[]|null); - - /** DescriptorProto nestedType */ - nestedType?: (google.protobuf.IDescriptorProto[]|null); - - /** DescriptorProto enumType */ - enumType?: (google.protobuf.IEnumDescriptorProto[]|null); - - /** DescriptorProto extensionRange */ - extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); - - /** DescriptorProto oneofDecl */ - oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); - - /** DescriptorProto options */ - options?: (google.protobuf.IMessageOptions|null); - - /** DescriptorProto reservedRange */ - reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); - - /** DescriptorProto reservedName */ - reservedName?: (string[]|null); - } - - /** Represents a DescriptorProto. */ - class DescriptorProto implements IDescriptorProto { - - /** - * Constructs a new DescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IDescriptorProto); - - /** DescriptorProto name. */ - public name: string; - - /** DescriptorProto field. */ - public field: google.protobuf.IFieldDescriptorProto[]; - - /** DescriptorProto extension. */ - public extension: google.protobuf.IFieldDescriptorProto[]; - - /** DescriptorProto nestedType. */ - public nestedType: google.protobuf.IDescriptorProto[]; - - /** DescriptorProto enumType. */ - public enumType: google.protobuf.IEnumDescriptorProto[]; - - /** DescriptorProto extensionRange. */ - public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; - - /** DescriptorProto oneofDecl. */ - public oneofDecl: google.protobuf.IOneofDescriptorProto[]; - - /** DescriptorProto options. */ - public options?: (google.protobuf.IMessageOptions|null); - - /** DescriptorProto reservedRange. */ - public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; - - /** DescriptorProto reservedName. */ - public reservedName: string[]; - - /** - * Creates a new DescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns DescriptorProto instance - */ - public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; - - /** - * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @param message DescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @param message DescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DescriptorProto - * @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.protobuf.DescriptorProto; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DescriptorProto - * @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.protobuf.DescriptorProto; - - /** - * Verifies a DescriptorProto 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 DescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; - - /** - * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. - * @param message DescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DescriptorProto { - - /** Properties of an ExtensionRange. */ - interface IExtensionRange { - - /** ExtensionRange start */ - start?: (number|null); - - /** ExtensionRange end */ - end?: (number|null); - - /** ExtensionRange options */ - options?: (google.protobuf.IExtensionRangeOptions|null); - } - - /** Represents an ExtensionRange. */ - class ExtensionRange implements IExtensionRange { - - /** - * Constructs a new ExtensionRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); - - /** ExtensionRange start. */ - public start: number; - - /** ExtensionRange end. */ - public end: number; - - /** ExtensionRange options. */ - public options?: (google.protobuf.IExtensionRangeOptions|null); - - /** - * Creates a new ExtensionRange instance using the specified properties. - * @param [properties] Properties to set - * @returns ExtensionRange instance - */ - public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @param message ExtensionRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @param message ExtensionRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExtensionRange - * @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.protobuf.DescriptorProto.ExtensionRange; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExtensionRange - * @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.protobuf.DescriptorProto.ExtensionRange; - - /** - * Verifies an ExtensionRange 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 ExtensionRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExtensionRange - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. - * @param message ExtensionRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExtensionRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExtensionRange - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReservedRange. */ - interface IReservedRange { - - /** ReservedRange start */ - start?: (number|null); - - /** ReservedRange end */ - end?: (number|null); - } - - /** Represents a ReservedRange. */ - class ReservedRange implements IReservedRange { - - /** - * Constructs a new ReservedRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); - - /** ReservedRange start. */ - public start: number; - - /** ReservedRange end. */ - public end: number; - - /** - * Creates a new ReservedRange instance using the specified properties. - * @param [properties] Properties to set - * @returns ReservedRange instance - */ - public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @param message ReservedRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @param message ReservedRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReservedRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReservedRange - * @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.protobuf.DescriptorProto.ReservedRange; - - /** - * Decodes a ReservedRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReservedRange - * @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.protobuf.DescriptorProto.ReservedRange; - - /** - * Verifies a ReservedRange 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 ReservedRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReservedRange - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. - * @param message ReservedRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReservedRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReservedRange - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of an ExtensionRangeOptions. */ - interface IExtensionRangeOptions { - - /** ExtensionRangeOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - } - - /** Represents an ExtensionRangeOptions. */ - class ExtensionRangeOptions implements IExtensionRangeOptions { - - /** - * Constructs a new ExtensionRangeOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IExtensionRangeOptions); - - /** ExtensionRangeOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new ExtensionRangeOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns ExtensionRangeOptions instance - */ - public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; - - /** - * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @param message ExtensionRangeOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @param message ExtensionRangeOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExtensionRangeOptions - * @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.protobuf.ExtensionRangeOptions; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExtensionRangeOptions - * @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.protobuf.ExtensionRangeOptions; - - /** - * Verifies an ExtensionRangeOptions 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 ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExtensionRangeOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; - - /** - * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. - * @param message ExtensionRangeOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExtensionRangeOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExtensionRangeOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FieldDescriptorProto. */ - interface IFieldDescriptorProto { - - /** FieldDescriptorProto name */ - name?: (string|null); - - /** FieldDescriptorProto number */ - number?: (number|null); - - /** FieldDescriptorProto label */ - label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); - - /** FieldDescriptorProto type */ - type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); - - /** FieldDescriptorProto typeName */ - typeName?: (string|null); - - /** FieldDescriptorProto extendee */ - extendee?: (string|null); - - /** FieldDescriptorProto defaultValue */ - defaultValue?: (string|null); - - /** FieldDescriptorProto oneofIndex */ - oneofIndex?: (number|null); - - /** FieldDescriptorProto jsonName */ - jsonName?: (string|null); - - /** FieldDescriptorProto options */ - options?: (google.protobuf.IFieldOptions|null); - - /** FieldDescriptorProto proto3Optional */ - proto3Optional?: (boolean|null); - } - - /** Represents a FieldDescriptorProto. */ - class FieldDescriptorProto implements IFieldDescriptorProto { - - /** - * Constructs a new FieldDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFieldDescriptorProto); - - /** FieldDescriptorProto name. */ - public name: string; - - /** FieldDescriptorProto number. */ - public number: number; - - /** FieldDescriptorProto label. */ - public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); - - /** FieldDescriptorProto type. */ - public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); - - /** FieldDescriptorProto typeName. */ - public typeName: string; - - /** FieldDescriptorProto extendee. */ - public extendee: string; - - /** FieldDescriptorProto defaultValue. */ - public defaultValue: string; - - /** FieldDescriptorProto oneofIndex. */ - public oneofIndex: number; - - /** FieldDescriptorProto jsonName. */ - public jsonName: string; - - /** FieldDescriptorProto options. */ - public options?: (google.protobuf.IFieldOptions|null); - - /** FieldDescriptorProto proto3Optional. */ - public proto3Optional: boolean; - - /** - * Creates a new FieldDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldDescriptorProto instance - */ - public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; - - /** - * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @param message FieldDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @param message FieldDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldDescriptorProto - * @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.protobuf.FieldDescriptorProto; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldDescriptorProto - * @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.protobuf.FieldDescriptorProto; - - /** - * Verifies a FieldDescriptorProto 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 FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; - - /** - * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. - * @param message FieldDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FieldDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FieldDescriptorProto { - - /** Type enum. */ - enum Type { - TYPE_DOUBLE = 1, - TYPE_FLOAT = 2, - TYPE_INT64 = 3, - TYPE_UINT64 = 4, - TYPE_INT32 = 5, - TYPE_FIXED64 = 6, - TYPE_FIXED32 = 7, - TYPE_BOOL = 8, - TYPE_STRING = 9, - TYPE_GROUP = 10, - TYPE_MESSAGE = 11, - TYPE_BYTES = 12, - TYPE_UINT32 = 13, - TYPE_ENUM = 14, - TYPE_SFIXED32 = 15, - TYPE_SFIXED64 = 16, - TYPE_SINT32 = 17, - TYPE_SINT64 = 18 - } - - /** Label enum. */ - enum Label { - LABEL_OPTIONAL = 1, - LABEL_REQUIRED = 2, - LABEL_REPEATED = 3 - } - } - - /** Properties of an OneofDescriptorProto. */ - interface IOneofDescriptorProto { - - /** OneofDescriptorProto name */ - name?: (string|null); - - /** OneofDescriptorProto options */ - options?: (google.protobuf.IOneofOptions|null); - } - - /** Represents an OneofDescriptorProto. */ - class OneofDescriptorProto implements IOneofDescriptorProto { - - /** - * Constructs a new OneofDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IOneofDescriptorProto); - - /** OneofDescriptorProto name. */ - public name: string; - - /** OneofDescriptorProto options. */ - public options?: (google.protobuf.IOneofOptions|null); - - /** - * Creates a new OneofDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns OneofDescriptorProto instance - */ - public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; - - /** - * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @param message OneofDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @param message OneofDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OneofDescriptorProto - * @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.protobuf.OneofDescriptorProto; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OneofDescriptorProto - * @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.protobuf.OneofDescriptorProto; - - /** - * Verifies an OneofDescriptorProto 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 OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OneofDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; - - /** - * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. - * @param message OneofDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OneofDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OneofDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an EnumDescriptorProto. */ - interface IEnumDescriptorProto { - - /** EnumDescriptorProto name */ - name?: (string|null); - - /** EnumDescriptorProto value */ - value?: (google.protobuf.IEnumValueDescriptorProto[]|null); - - /** EnumDescriptorProto options */ - options?: (google.protobuf.IEnumOptions|null); - - /** EnumDescriptorProto reservedRange */ - reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); - - /** EnumDescriptorProto reservedName */ - reservedName?: (string[]|null); - } - - /** Represents an EnumDescriptorProto. */ - class EnumDescriptorProto implements IEnumDescriptorProto { - - /** - * Constructs a new EnumDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEnumDescriptorProto); - - /** EnumDescriptorProto name. */ - public name: string; - - /** EnumDescriptorProto value. */ - public value: google.protobuf.IEnumValueDescriptorProto[]; - - /** EnumDescriptorProto options. */ - public options?: (google.protobuf.IEnumOptions|null); - - /** EnumDescriptorProto reservedRange. */ - public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; - - /** EnumDescriptorProto reservedName. */ - public reservedName: string[]; - - /** - * Creates a new EnumDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumDescriptorProto instance - */ - public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; - - /** - * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @param message EnumDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @param message EnumDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumDescriptorProto - * @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.protobuf.EnumDescriptorProto; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumDescriptorProto - * @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.protobuf.EnumDescriptorProto; - - /** - * Verifies an EnumDescriptorProto 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 EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; - - /** - * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. - * @param message EnumDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace EnumDescriptorProto { - - /** Properties of an EnumReservedRange. */ - interface IEnumReservedRange { - - /** EnumReservedRange start */ - start?: (number|null); - - /** EnumReservedRange end */ - end?: (number|null); - } - - /** Represents an EnumReservedRange. */ - class EnumReservedRange implements IEnumReservedRange { - - /** - * Constructs a new EnumReservedRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); - - /** EnumReservedRange start. */ - public start: number; - - /** EnumReservedRange end. */ - public end: number; - - /** - * Creates a new EnumReservedRange instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumReservedRange instance - */ - public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; - - /** - * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. - * @param message EnumReservedRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. - * @param message EnumReservedRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumReservedRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumReservedRange - * @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.protobuf.EnumDescriptorProto.EnumReservedRange; - - /** - * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumReservedRange - * @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.protobuf.EnumDescriptorProto.EnumReservedRange; - - /** - * Verifies an EnumReservedRange 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 EnumReservedRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumReservedRange - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; - - /** - * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. - * @param message EnumReservedRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumReservedRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumReservedRange - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of an EnumValueDescriptorProto. */ - interface IEnumValueDescriptorProto { - - /** EnumValueDescriptorProto name */ - name?: (string|null); - - /** EnumValueDescriptorProto number */ - number?: (number|null); - - /** EnumValueDescriptorProto options */ - options?: (google.protobuf.IEnumValueOptions|null); - } - - /** Represents an EnumValueDescriptorProto. */ - class EnumValueDescriptorProto implements IEnumValueDescriptorProto { - - /** - * Constructs a new EnumValueDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEnumValueDescriptorProto); - - /** EnumValueDescriptorProto name. */ - public name: string; - - /** EnumValueDescriptorProto number. */ - public number: number; - - /** EnumValueDescriptorProto options. */ - public options?: (google.protobuf.IEnumValueOptions|null); - - /** - * Creates a new EnumValueDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumValueDescriptorProto instance - */ - public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; - - /** - * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @param message EnumValueDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @param message EnumValueDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumValueDescriptorProto - * @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.protobuf.EnumValueDescriptorProto; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumValueDescriptorProto - * @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.protobuf.EnumValueDescriptorProto; - - /** - * Verifies an EnumValueDescriptorProto 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 EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumValueDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; - - /** - * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. - * @param message EnumValueDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumValueDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumValueDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ServiceDescriptorProto. */ - interface IServiceDescriptorProto { - - /** ServiceDescriptorProto name */ - name?: (string|null); - - /** ServiceDescriptorProto method */ - method?: (google.protobuf.IMethodDescriptorProto[]|null); - - /** ServiceDescriptorProto options */ - options?: (google.protobuf.IServiceOptions|null); - } - - /** Represents a ServiceDescriptorProto. */ - class ServiceDescriptorProto implements IServiceDescriptorProto { - - /** - * Constructs a new ServiceDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IServiceDescriptorProto); - - /** ServiceDescriptorProto name. */ - public name: string; - - /** ServiceDescriptorProto method. */ - public method: google.protobuf.IMethodDescriptorProto[]; - - /** ServiceDescriptorProto options. */ - public options?: (google.protobuf.IServiceOptions|null); - - /** - * Creates a new ServiceDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns ServiceDescriptorProto instance - */ - public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; - - /** - * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @param message ServiceDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @param message ServiceDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ServiceDescriptorProto - * @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.protobuf.ServiceDescriptorProto; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ServiceDescriptorProto - * @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.protobuf.ServiceDescriptorProto; - - /** - * Verifies a ServiceDescriptorProto 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 ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ServiceDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; - - /** - * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. - * @param message ServiceDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ServiceDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ServiceDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MethodDescriptorProto. */ - interface IMethodDescriptorProto { - - /** MethodDescriptorProto name */ - name?: (string|null); - - /** MethodDescriptorProto inputType */ - inputType?: (string|null); - - /** MethodDescriptorProto outputType */ - outputType?: (string|null); - - /** MethodDescriptorProto options */ - options?: (google.protobuf.IMethodOptions|null); - - /** MethodDescriptorProto clientStreaming */ - clientStreaming?: (boolean|null); - - /** MethodDescriptorProto serverStreaming */ - serverStreaming?: (boolean|null); - } - - /** Represents a MethodDescriptorProto. */ - class MethodDescriptorProto implements IMethodDescriptorProto { - - /** - * Constructs a new MethodDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IMethodDescriptorProto); - - /** MethodDescriptorProto name. */ - public name: string; - - /** MethodDescriptorProto inputType. */ - public inputType: string; - - /** MethodDescriptorProto outputType. */ - public outputType: string; - - /** MethodDescriptorProto options. */ - public options?: (google.protobuf.IMethodOptions|null); - - /** MethodDescriptorProto clientStreaming. */ - public clientStreaming: boolean; - - /** MethodDescriptorProto serverStreaming. */ - public serverStreaming: boolean; - - /** - * Creates a new MethodDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns MethodDescriptorProto instance - */ - public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; - - /** - * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @param message MethodDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @param message MethodDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MethodDescriptorProto - * @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.protobuf.MethodDescriptorProto; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MethodDescriptorProto - * @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.protobuf.MethodDescriptorProto; - - /** - * Verifies a MethodDescriptorProto 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 MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MethodDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; - - /** - * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. - * @param message MethodDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MethodDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MethodDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FileOptions. */ - interface IFileOptions { - - /** FileOptions javaPackage */ - javaPackage?: (string|null); - - /** FileOptions javaOuterClassname */ - javaOuterClassname?: (string|null); - - /** FileOptions javaMultipleFiles */ - javaMultipleFiles?: (boolean|null); - - /** FileOptions javaGenerateEqualsAndHash */ - javaGenerateEqualsAndHash?: (boolean|null); - - /** FileOptions javaStringCheckUtf8 */ - javaStringCheckUtf8?: (boolean|null); - - /** FileOptions optimizeFor */ - optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); - - /** FileOptions goPackage */ - goPackage?: (string|null); - - /** FileOptions ccGenericServices */ - ccGenericServices?: (boolean|null); - - /** FileOptions javaGenericServices */ - javaGenericServices?: (boolean|null); - - /** FileOptions pyGenericServices */ - pyGenericServices?: (boolean|null); - - /** FileOptions phpGenericServices */ - phpGenericServices?: (boolean|null); - - /** FileOptions deprecated */ - deprecated?: (boolean|null); - - /** FileOptions ccEnableArenas */ - ccEnableArenas?: (boolean|null); - - /** FileOptions objcClassPrefix */ - objcClassPrefix?: (string|null); - - /** FileOptions csharpNamespace */ - csharpNamespace?: (string|null); - - /** FileOptions swiftPrefix */ - swiftPrefix?: (string|null); - - /** FileOptions phpClassPrefix */ - phpClassPrefix?: (string|null); - - /** FileOptions phpNamespace */ - phpNamespace?: (string|null); - - /** FileOptions phpMetadataNamespace */ - phpMetadataNamespace?: (string|null); - - /** FileOptions rubyPackage */ - rubyPackage?: (string|null); - - /** FileOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** FileOptions .google.api.resourceDefinition */ - ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); - } - - /** Represents a FileOptions. */ - class FileOptions implements IFileOptions { - - /** - * Constructs a new FileOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFileOptions); - - /** FileOptions javaPackage. */ - public javaPackage: string; - - /** FileOptions javaOuterClassname. */ - public javaOuterClassname: string; - - /** FileOptions javaMultipleFiles. */ - public javaMultipleFiles: boolean; - - /** FileOptions javaGenerateEqualsAndHash. */ - public javaGenerateEqualsAndHash: boolean; - - /** FileOptions javaStringCheckUtf8. */ - public javaStringCheckUtf8: boolean; - - /** FileOptions optimizeFor. */ - public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); - - /** FileOptions goPackage. */ - public goPackage: string; - - /** FileOptions ccGenericServices. */ - public ccGenericServices: boolean; - - /** FileOptions javaGenericServices. */ - public javaGenericServices: boolean; - - /** FileOptions pyGenericServices. */ - public pyGenericServices: boolean; - - /** FileOptions phpGenericServices. */ - public phpGenericServices: boolean; - - /** FileOptions deprecated. */ - public deprecated: boolean; - - /** FileOptions ccEnableArenas. */ - public ccEnableArenas: boolean; - - /** FileOptions objcClassPrefix. */ - public objcClassPrefix: string; - - /** FileOptions csharpNamespace. */ - public csharpNamespace: string; - - /** FileOptions swiftPrefix. */ - public swiftPrefix: string; - - /** FileOptions phpClassPrefix. */ - public phpClassPrefix: string; - - /** FileOptions phpNamespace. */ - public phpNamespace: string; - - /** FileOptions phpMetadataNamespace. */ - public phpMetadataNamespace: string; - - /** FileOptions rubyPackage. */ - public rubyPackage: string; - - /** FileOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new FileOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns FileOptions instance - */ - public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; - - /** - * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @param message FileOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @param message FileOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FileOptions - * @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.protobuf.FileOptions; - - /** - * Decodes a FileOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FileOptions - * @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.protobuf.FileOptions; - - /** - * Verifies a FileOptions 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 FileOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FileOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; - - /** - * Creates a plain object from a FileOptions message. Also converts values to other types if specified. - * @param message FileOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FileOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FileOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FileOptions { - - /** OptimizeMode enum. */ - enum OptimizeMode { - SPEED = 1, - CODE_SIZE = 2, - LITE_RUNTIME = 3 - } - } - - /** Properties of a MessageOptions. */ - interface IMessageOptions { - - /** MessageOptions messageSetWireFormat */ - messageSetWireFormat?: (boolean|null); - - /** MessageOptions noStandardDescriptorAccessor */ - noStandardDescriptorAccessor?: (boolean|null); - - /** MessageOptions deprecated */ - deprecated?: (boolean|null); - - /** MessageOptions mapEntry */ - mapEntry?: (boolean|null); - - /** MessageOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** MessageOptions .google.api.resource */ - ".google.api.resource"?: (google.api.IResourceDescriptor|null); - } - - /** Represents a MessageOptions. */ - class MessageOptions implements IMessageOptions { - - /** - * Constructs a new MessageOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IMessageOptions); - - /** MessageOptions messageSetWireFormat. */ - public messageSetWireFormat: boolean; - - /** MessageOptions noStandardDescriptorAccessor. */ - public noStandardDescriptorAccessor: boolean; - - /** MessageOptions deprecated. */ - public deprecated: boolean; - - /** MessageOptions mapEntry. */ - public mapEntry: boolean; - - /** MessageOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new MessageOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns MessageOptions instance - */ - public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; - - /** - * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @param message MessageOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @param message MessageOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MessageOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MessageOptions - * @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.protobuf.MessageOptions; - - /** - * Decodes a MessageOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MessageOptions - * @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.protobuf.MessageOptions; - - /** - * Verifies a MessageOptions 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 MessageOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MessageOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; - - /** - * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. - * @param message MessageOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MessageOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MessageOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FieldOptions. */ - interface IFieldOptions { - - /** FieldOptions ctype */ - ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); - - /** FieldOptions packed */ - packed?: (boolean|null); - - /** FieldOptions jstype */ - jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); - - /** FieldOptions lazy */ - lazy?: (boolean|null); - - /** FieldOptions unverifiedLazy */ - unverifiedLazy?: (boolean|null); - - /** FieldOptions deprecated */ - deprecated?: (boolean|null); - - /** FieldOptions weak */ - weak?: (boolean|null); - - /** FieldOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** FieldOptions .google.api.fieldBehavior */ - ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); - - /** FieldOptions .google.api.resourceReference */ - ".google.api.resourceReference"?: (google.api.IResourceReference|null); - } - - /** Represents a FieldOptions. */ - class FieldOptions implements IFieldOptions { - - /** - * Constructs a new FieldOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFieldOptions); - - /** FieldOptions ctype. */ - public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); - - /** FieldOptions packed. */ - public packed: boolean; - - /** FieldOptions jstype. */ - public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); - - /** FieldOptions lazy. */ - public lazy: boolean; - - /** FieldOptions unverifiedLazy. */ - public unverifiedLazy: boolean; - - /** FieldOptions deprecated. */ - public deprecated: boolean; - - /** FieldOptions weak. */ - public weak: boolean; - - /** FieldOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new FieldOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldOptions instance - */ - public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; - - /** - * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @param message FieldOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @param message FieldOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldOptions - * @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.protobuf.FieldOptions; - - /** - * Decodes a FieldOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldOptions - * @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.protobuf.FieldOptions; - - /** - * Verifies a FieldOptions 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 FieldOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; - - /** - * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. - * @param message FieldOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FieldOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FieldOptions { - - /** CType enum. */ - enum CType { - STRING = 0, - CORD = 1, - STRING_PIECE = 2 - } - - /** JSType enum. */ - enum JSType { - JS_NORMAL = 0, - JS_STRING = 1, - JS_NUMBER = 2 - } - } - - /** Properties of an OneofOptions. */ - interface IOneofOptions { - - /** OneofOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - } - - /** Represents an OneofOptions. */ - class OneofOptions implements IOneofOptions { - - /** - * Constructs a new OneofOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IOneofOptions); - - /** OneofOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new OneofOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns OneofOptions instance - */ - public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; - - /** - * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @param message OneofOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @param message OneofOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OneofOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OneofOptions - * @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.protobuf.OneofOptions; - - /** - * Decodes an OneofOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OneofOptions - * @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.protobuf.OneofOptions; - - /** - * Verifies an OneofOptions 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 OneofOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OneofOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; - - /** - * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. - * @param message OneofOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OneofOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OneofOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an EnumOptions. */ - interface IEnumOptions { - - /** EnumOptions allowAlias */ - allowAlias?: (boolean|null); - - /** EnumOptions deprecated */ - deprecated?: (boolean|null); - - /** EnumOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - } - - /** Represents an EnumOptions. */ - class EnumOptions implements IEnumOptions { - - /** - * Constructs a new EnumOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEnumOptions); - - /** EnumOptions allowAlias. */ - public allowAlias: boolean; - - /** EnumOptions deprecated. */ - public deprecated: boolean; - - /** EnumOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new EnumOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumOptions instance - */ - public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; - - /** - * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @param message EnumOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @param message EnumOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumOptions - * @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.protobuf.EnumOptions; - - /** - * Decodes an EnumOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumOptions - * @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.protobuf.EnumOptions; - - /** - * Verifies an EnumOptions 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 EnumOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; - - /** - * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. - * @param message EnumOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an EnumValueOptions. */ - interface IEnumValueOptions { - - /** EnumValueOptions deprecated */ - deprecated?: (boolean|null); - - /** EnumValueOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - } - - /** Represents an EnumValueOptions. */ - class EnumValueOptions implements IEnumValueOptions { - - /** - * Constructs a new EnumValueOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEnumValueOptions); - - /** EnumValueOptions deprecated. */ - public deprecated: boolean; - - /** EnumValueOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new EnumValueOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumValueOptions instance - */ - public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; - - /** - * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @param message EnumValueOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @param message EnumValueOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumValueOptions - * @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.protobuf.EnumValueOptions; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumValueOptions - * @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.protobuf.EnumValueOptions; - - /** - * Verifies an EnumValueOptions 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 EnumValueOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumValueOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; - - /** - * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. - * @param message EnumValueOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumValueOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumValueOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ServiceOptions. */ - interface IServiceOptions { - - /** ServiceOptions deprecated */ - deprecated?: (boolean|null); - - /** ServiceOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** ServiceOptions .google.api.defaultHost */ - ".google.api.defaultHost"?: (string|null); - - /** ServiceOptions .google.api.oauthScopes */ - ".google.api.oauthScopes"?: (string|null); - } - - /** Represents a ServiceOptions. */ - class ServiceOptions implements IServiceOptions { - - /** - * Constructs a new ServiceOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IServiceOptions); - - /** ServiceOptions deprecated. */ - public deprecated: boolean; - - /** ServiceOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new ServiceOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns ServiceOptions instance - */ - public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; - - /** - * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @param message ServiceOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @param message ServiceOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ServiceOptions - * @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.protobuf.ServiceOptions; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ServiceOptions - * @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.protobuf.ServiceOptions; - - /** - * Verifies a ServiceOptions 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 ServiceOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ServiceOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; - - /** - * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. - * @param message ServiceOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ServiceOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ServiceOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MethodOptions. */ - interface IMethodOptions { - - /** MethodOptions deprecated */ - deprecated?: (boolean|null); - - /** MethodOptions idempotencyLevel */ - idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); - - /** MethodOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** MethodOptions .google.api.http */ - ".google.api.http"?: (google.api.IHttpRule|null); - - /** MethodOptions .google.api.methodSignature */ - ".google.api.methodSignature"?: (string[]|null); - - /** MethodOptions .google.longrunning.operationInfo */ - ".google.longrunning.operationInfo"?: (google.longrunning.IOperationInfo|null); - } - - /** Represents a MethodOptions. */ - class MethodOptions implements IMethodOptions { - - /** - * Constructs a new MethodOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IMethodOptions); - - /** MethodOptions deprecated. */ - public deprecated: boolean; - - /** MethodOptions idempotencyLevel. */ - public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); - - /** MethodOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new MethodOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns MethodOptions instance - */ - public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; - - /** - * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @param message MethodOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @param message MethodOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MethodOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MethodOptions - * @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.protobuf.MethodOptions; - - /** - * Decodes a MethodOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MethodOptions - * @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.protobuf.MethodOptions; - - /** - * Verifies a MethodOptions 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 MethodOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MethodOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; - - /** - * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. - * @param message MethodOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MethodOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MethodOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace MethodOptions { - - /** IdempotencyLevel enum. */ - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0, - NO_SIDE_EFFECTS = 1, - IDEMPOTENT = 2 - } - } - - /** Properties of an UninterpretedOption. */ - interface IUninterpretedOption { - - /** UninterpretedOption name */ - name?: (google.protobuf.UninterpretedOption.INamePart[]|null); - - /** UninterpretedOption identifierValue */ - identifierValue?: (string|null); - - /** UninterpretedOption positiveIntValue */ - positiveIntValue?: (number|Long|string|null); - - /** UninterpretedOption negativeIntValue */ - negativeIntValue?: (number|Long|string|null); - - /** UninterpretedOption doubleValue */ - doubleValue?: (number|null); - - /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|string|null); - - /** UninterpretedOption aggregateValue */ - aggregateValue?: (string|null); - } - - /** Represents an UninterpretedOption. */ - class UninterpretedOption implements IUninterpretedOption { - - /** - * Constructs a new UninterpretedOption. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IUninterpretedOption); - - /** UninterpretedOption name. */ - public name: google.protobuf.UninterpretedOption.INamePart[]; - - /** UninterpretedOption identifierValue. */ - public identifierValue: string; - - /** UninterpretedOption positiveIntValue. */ - public positiveIntValue: (number|Long|string); - - /** UninterpretedOption negativeIntValue. */ - public negativeIntValue: (number|Long|string); - - /** UninterpretedOption doubleValue. */ - public doubleValue: number; - - /** UninterpretedOption stringValue. */ - public stringValue: (Uint8Array|string); - - /** UninterpretedOption aggregateValue. */ - public aggregateValue: string; - - /** - * Creates a new UninterpretedOption instance using the specified properties. - * @param [properties] Properties to set - * @returns UninterpretedOption instance - */ - public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; - - /** - * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @param message UninterpretedOption message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @param message UninterpretedOption message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UninterpretedOption - * @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.protobuf.UninterpretedOption; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UninterpretedOption - * @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.protobuf.UninterpretedOption; - - /** - * Verifies an UninterpretedOption 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 UninterpretedOption message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UninterpretedOption - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; - - /** - * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. - * @param message UninterpretedOption - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UninterpretedOption to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UninterpretedOption - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace UninterpretedOption { - - /** Properties of a NamePart. */ - interface INamePart { - - /** NamePart namePart */ - namePart: string; - - /** NamePart isExtension */ - isExtension: boolean; - } - - /** Represents a NamePart. */ - class NamePart implements INamePart { - - /** - * Constructs a new NamePart. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.UninterpretedOption.INamePart); - - /** NamePart namePart. */ - public namePart: string; - - /** NamePart isExtension. */ - public isExtension: boolean; - - /** - * Creates a new NamePart instance using the specified properties. - * @param [properties] Properties to set - * @returns NamePart instance - */ - public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; - - /** - * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @param message NamePart message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @param message NamePart message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NamePart message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns NamePart - * @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.protobuf.UninterpretedOption.NamePart; - - /** - * Decodes a NamePart message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns NamePart - * @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.protobuf.UninterpretedOption.NamePart; - - /** - * Verifies a NamePart 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 NamePart message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns NamePart - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; - - /** - * Creates a plain object from a NamePart message. Also converts values to other types if specified. - * @param message NamePart - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NamePart to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for NamePart - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SourceCodeInfo. */ - interface ISourceCodeInfo { - - /** SourceCodeInfo location */ - location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); - } - - /** Represents a SourceCodeInfo. */ - class SourceCodeInfo implements ISourceCodeInfo { - - /** - * Constructs a new SourceCodeInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.ISourceCodeInfo); - - /** SourceCodeInfo location. */ - public location: google.protobuf.SourceCodeInfo.ILocation[]; - - /** - * Creates a new SourceCodeInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns SourceCodeInfo instance - */ - public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; - - /** - * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @param message SourceCodeInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @param message SourceCodeInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SourceCodeInfo - * @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.protobuf.SourceCodeInfo; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SourceCodeInfo - * @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.protobuf.SourceCodeInfo; - - /** - * Verifies a SourceCodeInfo 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 SourceCodeInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SourceCodeInfo - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; - - /** - * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. - * @param message SourceCodeInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SourceCodeInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SourceCodeInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SourceCodeInfo { - - /** Properties of a Location. */ - interface ILocation { - - /** Location path */ - path?: (number[]|null); - - /** Location span */ - span?: (number[]|null); - - /** Location leadingComments */ - leadingComments?: (string|null); - - /** Location trailingComments */ - trailingComments?: (string|null); - - /** Location leadingDetachedComments */ - leadingDetachedComments?: (string[]|null); - } - - /** Represents a Location. */ - class Location implements ILocation { - - /** - * Constructs a new Location. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); - - /** Location path. */ - public path: number[]; - - /** Location span. */ - public span: number[]; - - /** Location leadingComments. */ - public leadingComments: string; - - /** Location trailingComments. */ - public trailingComments: string; - - /** Location leadingDetachedComments. */ - public leadingDetachedComments: string[]; - - /** - * Creates a new Location instance using the specified properties. - * @param [properties] Properties to set - * @returns Location instance - */ - public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; - - /** - * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @param message Location message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @param message Location message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Location message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Location - * @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.protobuf.SourceCodeInfo.Location; - - /** - * Decodes a Location message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Location - * @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.protobuf.SourceCodeInfo.Location; - - /** - * Verifies a Location 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 Location message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Location - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; - - /** - * Creates a plain object from a Location message. Also converts values to other types if specified. - * @param message Location - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Location to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Location - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a GeneratedCodeInfo. */ - interface IGeneratedCodeInfo { - - /** GeneratedCodeInfo annotation */ - annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); - } - - /** Represents a GeneratedCodeInfo. */ - class GeneratedCodeInfo implements IGeneratedCodeInfo { - - /** - * Constructs a new GeneratedCodeInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IGeneratedCodeInfo); - - /** GeneratedCodeInfo annotation. */ - public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; - - /** - * Creates a new GeneratedCodeInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns GeneratedCodeInfo instance - */ - public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; - - /** - * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @param message GeneratedCodeInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @param message GeneratedCodeInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GeneratedCodeInfo - * @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.protobuf.GeneratedCodeInfo; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GeneratedCodeInfo - * @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.protobuf.GeneratedCodeInfo; - - /** - * Verifies a GeneratedCodeInfo 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 GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GeneratedCodeInfo - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; - - /** - * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. - * @param message GeneratedCodeInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GeneratedCodeInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GeneratedCodeInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace GeneratedCodeInfo { - - /** Properties of an Annotation. */ - interface IAnnotation { - - /** Annotation path */ - path?: (number[]|null); - - /** Annotation sourceFile */ - sourceFile?: (string|null); - - /** Annotation begin */ - begin?: (number|null); - - /** Annotation end */ - end?: (number|null); - - /** Annotation semantic */ - semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); - } - - /** Represents an Annotation. */ - class Annotation implements IAnnotation { - - /** - * Constructs a new Annotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); - - /** Annotation path. */ - public path: number[]; - - /** Annotation sourceFile. */ - public sourceFile: string; - - /** Annotation begin. */ - public begin: number; - - /** Annotation end. */ - public end: number; - - /** Annotation semantic. */ - public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); - - /** - * Creates a new Annotation instance using the specified properties. - * @param [properties] Properties to set - * @returns Annotation instance - */ - public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @param message Annotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @param message Annotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Annotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Annotation - * @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.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Decodes an Annotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Annotation - * @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.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Verifies an Annotation 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 Annotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Annotation - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Creates a plain object from an Annotation message. Also converts values to other types if specified. - * @param message Annotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Annotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Annotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Annotation { - - /** Semantic enum. */ - enum Semantic { - NONE = 0, - SET = 1, - ALIAS = 2 - } - } - } - - /** Properties of an Any. */ - interface IAny { - - /** Any type_url */ - type_url?: (string|null); - - /** Any value */ - value?: (Uint8Array|string|null); - } - - /** Represents an Any. */ - class Any implements IAny { - - /** - * Constructs a new Any. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IAny); - - /** Any type_url. */ - public type_url: string; - - /** Any value. */ - public value: (Uint8Array|string); - - /** - * Creates a new Any instance using the specified properties. - * @param [properties] Properties to set - * @returns Any instance - */ - public static create(properties?: google.protobuf.IAny): google.protobuf.Any; - - /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Any message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Any - * @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.protobuf.Any; - - /** - * Decodes an Any message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Any - * @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.protobuf.Any; - - /** - * Verifies an Any 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 Any message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Any - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Any; - - /** - * Creates a plain object from an Any message. Also converts values to other types if specified. - * @param message Any - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Any to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Any - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Duration. */ - interface IDuration { - - /** Duration seconds */ - seconds?: (number|Long|string|null); - - /** Duration nanos */ - nanos?: (number|null); - } - - /** Represents a Duration. */ - class Duration implements IDuration { - - /** - * Constructs a new Duration. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IDuration); - - /** Duration seconds. */ - public seconds: (number|Long|string); - - /** Duration nanos. */ - public nanos: number; - - /** - * Creates a new Duration instance using the specified properties. - * @param [properties] Properties to set - * @returns Duration instance - */ - public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; - - /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Duration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Duration - * @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.protobuf.Duration; - - /** - * Decodes a Duration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Duration - * @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.protobuf.Duration; - - /** - * Verifies a Duration 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 Duration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Duration - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; - - /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @param message Duration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Duration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Duration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Empty. */ - interface IEmpty { - } - - /** Represents an Empty. */ - class Empty implements IEmpty { - - /** - * Constructs a new Empty. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEmpty); - - /** - * Creates a new Empty instance using the specified properties. - * @param [properties] Properties to set - * @returns Empty instance - */ - public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; - - /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Empty message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Empty - * @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.protobuf.Empty; - - /** - * Decodes an Empty message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Empty - * @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.protobuf.Empty; - - /** - * Verifies an Empty 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 Empty message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Empty - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; - - /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @param message Empty - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Empty to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Empty - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FieldMask. */ - interface IFieldMask { - - /** FieldMask paths */ - paths?: (string[]|null); - } - - /** Represents a FieldMask. */ - class FieldMask implements IFieldMask { - - /** - * Constructs a new FieldMask. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFieldMask); - - /** FieldMask paths. */ - public paths: string[]; - - /** - * Creates a new FieldMask instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldMask instance - */ - public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; - - /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldMask message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldMask - * @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.protobuf.FieldMask; - - /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldMask - * @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.protobuf.FieldMask; - - /** - * Verifies a FieldMask 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 FieldMask message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldMask - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; - - /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @param message FieldMask - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldMask to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FieldMask - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Timestamp. */ - interface ITimestamp { - - /** Timestamp seconds */ - seconds?: (number|Long|string|null); - - /** Timestamp nanos */ - nanos?: (number|null); - } - - /** Represents a Timestamp. */ - class Timestamp implements ITimestamp { - - /** - * Constructs a new Timestamp. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.ITimestamp); - - /** Timestamp seconds. */ - public seconds: (number|Long|string); - - /** Timestamp nanos. */ - public nanos: number; - - /** - * Creates a new Timestamp instance using the specified properties. - * @param [properties] Properties to set - * @returns Timestamp instance - */ - public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; - - /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Timestamp message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Timestamp - * @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.protobuf.Timestamp; - - /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Timestamp - * @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.protobuf.Timestamp; - - /** - * Verifies a Timestamp 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 Timestamp message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Timestamp - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; - - /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @param message Timestamp - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Timestamp to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Timestamp - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DoubleValue. */ - interface IDoubleValue { - - /** DoubleValue value */ - value?: (number|null); - } - - /** Represents a DoubleValue. */ - class DoubleValue implements IDoubleValue { - - /** - * Constructs a new DoubleValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IDoubleValue); - - /** DoubleValue value. */ - public value: number; - - /** - * Creates a new DoubleValue instance using the specified properties. - * @param [properties] Properties to set - * @returns DoubleValue instance - */ - public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; - - /** - * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @param message DoubleValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @param message DoubleValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DoubleValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DoubleValue - * @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.protobuf.DoubleValue; - - /** - * Decodes a DoubleValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DoubleValue - * @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.protobuf.DoubleValue; - - /** - * Verifies a DoubleValue 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 DoubleValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DoubleValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; - - /** - * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. - * @param message DoubleValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DoubleValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DoubleValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FloatValue. */ - interface IFloatValue { - - /** FloatValue value */ - value?: (number|null); - } - - /** Represents a FloatValue. */ - class FloatValue implements IFloatValue { - - /** - * Constructs a new FloatValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFloatValue); - - /** FloatValue value. */ - public value: number; - - /** - * Creates a new FloatValue instance using the specified properties. - * @param [properties] Properties to set - * @returns FloatValue instance - */ - public static create(properties?: google.protobuf.IFloatValue): google.protobuf.FloatValue; - - /** - * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @param message FloatValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @param message FloatValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FloatValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FloatValue - * @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.protobuf.FloatValue; - - /** - * Decodes a FloatValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FloatValue - * @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.protobuf.FloatValue; - - /** - * Verifies a FloatValue 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 FloatValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FloatValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FloatValue; - - /** - * Creates a plain object from a FloatValue message. Also converts values to other types if specified. - * @param message FloatValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FloatValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FloatValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FloatValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Int64Value. */ - interface IInt64Value { - - /** Int64Value value */ - value?: (number|Long|string|null); - } - - /** Represents an Int64Value. */ - class Int64Value implements IInt64Value { - - /** - * Constructs a new Int64Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IInt64Value); - - /** Int64Value value. */ - public value: (number|Long|string); - - /** - * Creates a new Int64Value instance using the specified properties. - * @param [properties] Properties to set - * @returns Int64Value instance - */ - public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; - - /** - * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @param message Int64Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @param message Int64Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Int64Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Int64Value - * @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.protobuf.Int64Value; - - /** - * Decodes an Int64Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Int64Value - * @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.protobuf.Int64Value; - - /** - * Verifies an Int64Value 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 Int64Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Int64Value - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; - - /** - * Creates a plain object from an Int64Value message. Also converts values to other types if specified. - * @param message Int64Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Int64Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Int64Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a UInt64Value. */ - interface IUInt64Value { - - /** UInt64Value value */ - value?: (number|Long|string|null); - } - - /** Represents a UInt64Value. */ - class UInt64Value implements IUInt64Value { - - /** - * Constructs a new UInt64Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IUInt64Value); - - /** UInt64Value value. */ - public value: (number|Long|string); - - /** - * Creates a new UInt64Value instance using the specified properties. - * @param [properties] Properties to set - * @returns UInt64Value instance - */ - public static create(properties?: google.protobuf.IUInt64Value): google.protobuf.UInt64Value; - - /** - * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @param message UInt64Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @param message UInt64Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UInt64Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UInt64Value - * @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.protobuf.UInt64Value; - - /** - * Decodes a UInt64Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UInt64Value - * @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.protobuf.UInt64Value; - - /** - * Verifies a UInt64Value 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 UInt64Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UInt64Value - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UInt64Value; - - /** - * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. - * @param message UInt64Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.UInt64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UInt64Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UInt64Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Int32Value. */ - interface IInt32Value { - - /** Int32Value value */ - value?: (number|null); - } - - /** Represents an Int32Value. */ - class Int32Value implements IInt32Value { - - /** - * Constructs a new Int32Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IInt32Value); - - /** Int32Value value. */ - public value: number; - - /** - * Creates a new Int32Value instance using the specified properties. - * @param [properties] Properties to set - * @returns Int32Value instance - */ - public static create(properties?: google.protobuf.IInt32Value): google.protobuf.Int32Value; - - /** - * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @param message Int32Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @param message Int32Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Int32Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Int32Value - * @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.protobuf.Int32Value; - - /** - * Decodes an Int32Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Int32Value - * @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.protobuf.Int32Value; - - /** - * Verifies an Int32Value 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 Int32Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Int32Value - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Int32Value; - - /** - * Creates a plain object from an Int32Value message. Also converts values to other types if specified. - * @param message Int32Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Int32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Int32Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Int32Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a UInt32Value. */ - interface IUInt32Value { - - /** UInt32Value value */ - value?: (number|null); - } - - /** Represents a UInt32Value. */ - class UInt32Value implements IUInt32Value { - - /** - * Constructs a new UInt32Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IUInt32Value); - - /** UInt32Value value. */ - public value: number; - - /** - * Creates a new UInt32Value instance using the specified properties. - * @param [properties] Properties to set - * @returns UInt32Value instance - */ - public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; - - /** - * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @param message UInt32Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @param message UInt32Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UInt32Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UInt32Value - * @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.protobuf.UInt32Value; - - /** - * Decodes a UInt32Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UInt32Value - * @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.protobuf.UInt32Value; - - /** - * Verifies a UInt32Value 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 UInt32Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UInt32Value - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; - - /** - * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. - * @param message UInt32Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UInt32Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UInt32Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BoolValue. */ - interface IBoolValue { - - /** BoolValue value */ - value?: (boolean|null); - } - - /** Represents a BoolValue. */ - class BoolValue implements IBoolValue { - - /** - * Constructs a new BoolValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IBoolValue); - - /** BoolValue value. */ - public value: boolean; - - /** - * Creates a new BoolValue instance using the specified properties. - * @param [properties] Properties to set - * @returns BoolValue instance - */ - public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; - - /** - * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @param message BoolValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @param message BoolValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BoolValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoolValue - * @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.protobuf.BoolValue; - - /** - * Decodes a BoolValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoolValue - * @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.protobuf.BoolValue; - - /** - * Verifies a BoolValue 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 BoolValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoolValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; - - /** - * Creates a plain object from a BoolValue message. Also converts values to other types if specified. - * @param message BoolValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BoolValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BoolValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a StringValue. */ - interface IStringValue { - - /** StringValue value */ - value?: (string|null); - } - - /** Represents a StringValue. */ - class StringValue implements IStringValue { - - /** - * Constructs a new StringValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IStringValue); - - /** StringValue value. */ - public value: string; - - /** - * Creates a new StringValue instance using the specified properties. - * @param [properties] Properties to set - * @returns StringValue instance - */ - public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; - - /** - * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @param message StringValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @param message StringValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a StringValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns StringValue - * @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.protobuf.StringValue; - - /** - * Decodes a StringValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns StringValue - * @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.protobuf.StringValue; - - /** - * Verifies a StringValue 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 StringValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns StringValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; - - /** - * Creates a plain object from a StringValue message. Also converts values to other types if specified. - * @param message StringValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this StringValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for StringValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BytesValue. */ - interface IBytesValue { - - /** BytesValue value */ - value?: (Uint8Array|string|null); - } - - /** Represents a BytesValue. */ - class BytesValue implements IBytesValue { - - /** - * Constructs a new BytesValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IBytesValue); - - /** BytesValue value. */ - public value: (Uint8Array|string); - - /** - * Creates a new BytesValue instance using the specified properties. - * @param [properties] Properties to set - * @returns BytesValue instance - */ - public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; - - /** - * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @param message BytesValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @param message BytesValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BytesValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BytesValue - * @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.protobuf.BytesValue; - - /** - * Decodes a BytesValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BytesValue - * @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.protobuf.BytesValue; - - /** - * Verifies a BytesValue 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 BytesValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BytesValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; - - /** - * Creates a plain object from a BytesValue message. Also converts values to other types if specified. - * @param message BytesValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BytesValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BytesValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace longrunning. */ - namespace longrunning { - - /** Represents an Operations */ - class Operations extends $protobuf.rpc.Service { - - /** - * Constructs a new Operations 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); - - /** - * Creates new Operations 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): Operations; - - /** - * Calls ListOperations. - * @param request ListOperationsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListOperationsResponse - */ - public listOperations(request: google.longrunning.IListOperationsRequest, callback: google.longrunning.Operations.ListOperationsCallback): void; - - /** - * Calls ListOperations. - * @param request ListOperationsRequest message or plain object - * @returns Promise - */ - public listOperations(request: google.longrunning.IListOperationsRequest): Promise; - - /** - * Calls GetOperation. - * @param request GetOperationRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public getOperation(request: google.longrunning.IGetOperationRequest, callback: google.longrunning.Operations.GetOperationCallback): void; - - /** - * Calls GetOperation. - * @param request GetOperationRequest message or plain object - * @returns Promise - */ - public getOperation(request: google.longrunning.IGetOperationRequest): Promise; - - /** - * Calls DeleteOperation. - * @param request DeleteOperationRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public deleteOperation(request: google.longrunning.IDeleteOperationRequest, callback: google.longrunning.Operations.DeleteOperationCallback): void; - - /** - * Calls DeleteOperation. - * @param request DeleteOperationRequest message or plain object - * @returns Promise - */ - public deleteOperation(request: google.longrunning.IDeleteOperationRequest): Promise; - - /** - * Calls CancelOperation. - * @param request CancelOperationRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public cancelOperation(request: google.longrunning.ICancelOperationRequest, callback: google.longrunning.Operations.CancelOperationCallback): void; - - /** - * Calls CancelOperation. - * @param request CancelOperationRequest message or plain object - * @returns Promise - */ - public cancelOperation(request: google.longrunning.ICancelOperationRequest): Promise; - - /** - * Calls WaitOperation. - * @param request WaitOperationRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public waitOperation(request: google.longrunning.IWaitOperationRequest, callback: google.longrunning.Operations.WaitOperationCallback): void; - - /** - * Calls WaitOperation. - * @param request WaitOperationRequest message or plain object - * @returns Promise - */ - public waitOperation(request: google.longrunning.IWaitOperationRequest): Promise; - } - - namespace Operations { - - /** - * Callback as used by {@link google.longrunning.Operations|listOperations}. - * @param error Error, if any - * @param [response] ListOperationsResponse - */ - type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; - - /** - * Callback as used by {@link google.longrunning.Operations|getOperation}. - * @param error Error, if any - * @param [response] Operation - */ - type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - - /** - * Callback as used by {@link google.longrunning.Operations|deleteOperation}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.longrunning.Operations|cancelOperation}. - * @param error Error, if any - * @param [response] Empty - */ - type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - - /** - * Callback as used by {@link google.longrunning.Operations|waitOperation}. - * @param error Error, if any - * @param [response] Operation - */ - type WaitOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of an Operation. */ - interface IOperation { - - /** Operation name */ - name?: (string|null); - - /** Operation metadata */ - metadata?: (google.protobuf.IAny|null); - - /** Operation done */ - done?: (boolean|null); - - /** Operation error */ - error?: (google.rpc.IStatus|null); - - /** Operation response */ - response?: (google.protobuf.IAny|null); - } - - /** Represents an Operation. */ - class Operation implements IOperation { - - /** - * Constructs a new Operation. - * @param [properties] Properties to set - */ - constructor(properties?: google.longrunning.IOperation); - - /** Operation name. */ - public name: string; - - /** Operation metadata. */ - public metadata?: (google.protobuf.IAny|null); - - /** Operation done. */ - public done: boolean; - - /** Operation error. */ - public error?: (google.rpc.IStatus|null); - - /** Operation response. */ - public response?: (google.protobuf.IAny|null); - - /** Operation result. */ - public result?: ("error"|"response"); - - /** - * Creates a new Operation instance using the specified properties. - * @param [properties] Properties to set - * @returns Operation instance - */ - public static create(properties?: google.longrunning.IOperation): google.longrunning.Operation; - - /** - * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. - * @param message Operation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. - * @param message Operation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Operation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Operation - * @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.longrunning.Operation; - - /** - * Decodes an Operation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Operation - * @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.longrunning.Operation; - - /** - * Verifies an Operation 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 Operation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Operation - */ - public static fromObject(object: { [k: string]: any }): google.longrunning.Operation; - - /** - * Creates a plain object from an Operation message. Also converts values to other types if specified. - * @param message Operation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.longrunning.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Operation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Operation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetOperationRequest. */ - interface IGetOperationRequest { - - /** GetOperationRequest name */ - name?: (string|null); - } - - /** Represents a GetOperationRequest. */ - class GetOperationRequest implements IGetOperationRequest { - - /** - * Constructs a new GetOperationRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.longrunning.IGetOperationRequest); - - /** GetOperationRequest name. */ - public name: string; - - /** - * Creates a new GetOperationRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetOperationRequest instance - */ - public static create(properties?: google.longrunning.IGetOperationRequest): google.longrunning.GetOperationRequest; - - /** - * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. - * @param message GetOperationRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. - * @param message GetOperationRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetOperationRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetOperationRequest - * @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.longrunning.GetOperationRequest; - - /** - * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetOperationRequest - * @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.longrunning.GetOperationRequest; - - /** - * Verifies a GetOperationRequest 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 GetOperationRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetOperationRequest - */ - public static fromObject(object: { [k: string]: any }): google.longrunning.GetOperationRequest; - - /** - * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. - * @param message GetOperationRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.longrunning.GetOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetOperationRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetOperationRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListOperationsRequest. */ - interface IListOperationsRequest { - - /** ListOperationsRequest name */ - name?: (string|null); - - /** ListOperationsRequest filter */ - filter?: (string|null); - - /** ListOperationsRequest pageSize */ - pageSize?: (number|null); - - /** ListOperationsRequest pageToken */ - pageToken?: (string|null); - } - - /** Represents a ListOperationsRequest. */ - class ListOperationsRequest implements IListOperationsRequest { - - /** - * Constructs a new ListOperationsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.longrunning.IListOperationsRequest); - - /** ListOperationsRequest name. */ - public name: string; - - /** ListOperationsRequest filter. */ - public filter: string; - - /** ListOperationsRequest pageSize. */ - public pageSize: number; - - /** ListOperationsRequest pageToken. */ - public pageToken: string; - - /** - * Creates a new ListOperationsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListOperationsRequest instance - */ - public static create(properties?: google.longrunning.IListOperationsRequest): google.longrunning.ListOperationsRequest; - - /** - * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. - * @param message ListOperationsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. - * @param message ListOperationsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListOperationsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListOperationsRequest - * @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.longrunning.ListOperationsRequest; - - /** - * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListOperationsRequest - * @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.longrunning.ListOperationsRequest; - - /** - * Verifies a ListOperationsRequest 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 ListOperationsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListOperationsRequest - */ - public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsRequest; - - /** - * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. - * @param message ListOperationsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.longrunning.ListOperationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListOperationsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListOperationsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListOperationsResponse. */ - interface IListOperationsResponse { - - /** ListOperationsResponse operations */ - operations?: (google.longrunning.IOperation[]|null); - - /** ListOperationsResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a ListOperationsResponse. */ - class ListOperationsResponse implements IListOperationsResponse { - - /** - * Constructs a new ListOperationsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.longrunning.IListOperationsResponse); - - /** ListOperationsResponse operations. */ - public operations: google.longrunning.IOperation[]; - - /** ListOperationsResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new ListOperationsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListOperationsResponse instance - */ - public static create(properties?: google.longrunning.IListOperationsResponse): google.longrunning.ListOperationsResponse; - - /** - * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. - * @param message ListOperationsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. - * @param message ListOperationsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListOperationsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListOperationsResponse - * @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.longrunning.ListOperationsResponse; - - /** - * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListOperationsResponse - * @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.longrunning.ListOperationsResponse; - - /** - * Verifies a ListOperationsResponse 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 ListOperationsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListOperationsResponse - */ - public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsResponse; - - /** - * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. - * @param message ListOperationsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.longrunning.ListOperationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListOperationsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListOperationsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CancelOperationRequest. */ - interface ICancelOperationRequest { - - /** CancelOperationRequest name */ - name?: (string|null); - } - - /** Represents a CancelOperationRequest. */ - class CancelOperationRequest implements ICancelOperationRequest { - - /** - * Constructs a new CancelOperationRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.longrunning.ICancelOperationRequest); - - /** CancelOperationRequest name. */ - public name: string; - - /** - * Creates a new CancelOperationRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CancelOperationRequest instance - */ - public static create(properties?: google.longrunning.ICancelOperationRequest): google.longrunning.CancelOperationRequest; - - /** - * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. - * @param message CancelOperationRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. - * @param message CancelOperationRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CancelOperationRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CancelOperationRequest - * @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.longrunning.CancelOperationRequest; - - /** - * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CancelOperationRequest - * @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.longrunning.CancelOperationRequest; - - /** - * Verifies a CancelOperationRequest 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 CancelOperationRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CancelOperationRequest - */ - public static fromObject(object: { [k: string]: any }): google.longrunning.CancelOperationRequest; - - /** - * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. - * @param message CancelOperationRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.longrunning.CancelOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CancelOperationRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CancelOperationRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteOperationRequest. */ - interface IDeleteOperationRequest { - - /** DeleteOperationRequest name */ - name?: (string|null); - } - - /** Represents a DeleteOperationRequest. */ - class DeleteOperationRequest implements IDeleteOperationRequest { - - /** - * Constructs a new DeleteOperationRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.longrunning.IDeleteOperationRequest); - - /** DeleteOperationRequest name. */ - public name: string; - - /** - * Creates a new DeleteOperationRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteOperationRequest instance - */ - public static create(properties?: google.longrunning.IDeleteOperationRequest): google.longrunning.DeleteOperationRequest; - - /** - * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. - * @param message DeleteOperationRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. - * @param message DeleteOperationRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteOperationRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteOperationRequest - * @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.longrunning.DeleteOperationRequest; - - /** - * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteOperationRequest - * @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.longrunning.DeleteOperationRequest; - - /** - * Verifies a DeleteOperationRequest 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 DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteOperationRequest - */ - public static fromObject(object: { [k: string]: any }): google.longrunning.DeleteOperationRequest; - - /** - * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. - * @param message DeleteOperationRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.longrunning.DeleteOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteOperationRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteOperationRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a WaitOperationRequest. */ - interface IWaitOperationRequest { - - /** WaitOperationRequest name */ - name?: (string|null); - - /** WaitOperationRequest timeout */ - timeout?: (google.protobuf.IDuration|null); - } - - /** Represents a WaitOperationRequest. */ - class WaitOperationRequest implements IWaitOperationRequest { - - /** - * Constructs a new WaitOperationRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.longrunning.IWaitOperationRequest); - - /** WaitOperationRequest name. */ - public name: string; - - /** WaitOperationRequest timeout. */ - public timeout?: (google.protobuf.IDuration|null); - - /** - * Creates a new WaitOperationRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns WaitOperationRequest instance - */ - public static create(properties?: google.longrunning.IWaitOperationRequest): google.longrunning.WaitOperationRequest; - - /** - * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. - * @param message WaitOperationRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. - * @param message WaitOperationRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a WaitOperationRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns WaitOperationRequest - * @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.longrunning.WaitOperationRequest; - - /** - * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns WaitOperationRequest - * @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.longrunning.WaitOperationRequest; - - /** - * Verifies a WaitOperationRequest 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 WaitOperationRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns WaitOperationRequest - */ - public static fromObject(object: { [k: string]: any }): google.longrunning.WaitOperationRequest; - - /** - * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. - * @param message WaitOperationRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.longrunning.WaitOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this WaitOperationRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for WaitOperationRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OperationInfo. */ - interface IOperationInfo { - - /** OperationInfo responseType */ - responseType?: (string|null); - - /** OperationInfo metadataType */ - metadataType?: (string|null); - } - - /** Represents an OperationInfo. */ - class OperationInfo implements IOperationInfo { - - /** - * Constructs a new OperationInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.longrunning.IOperationInfo); - - /** OperationInfo responseType. */ - public responseType: string; - - /** OperationInfo metadataType. */ - public metadataType: string; - - /** - * Creates a new OperationInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationInfo instance - */ - public static create(properties?: google.longrunning.IOperationInfo): google.longrunning.OperationInfo; - - /** - * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. - * @param message OperationInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. - * @param message OperationInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationInfo - * @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.longrunning.OperationInfo; - - /** - * Decodes an OperationInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationInfo - * @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.longrunning.OperationInfo; - - /** - * Verifies an OperationInfo 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 OperationInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationInfo - */ - public static fromObject(object: { [k: string]: any }): google.longrunning.OperationInfo; - - /** - * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. - * @param message OperationInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.longrunning.OperationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace rpc. */ - namespace rpc { - - /** Properties of a Status. */ - interface IStatus { - - /** Status code */ - code?: (number|null); - - /** Status message */ - message?: (string|null); - - /** Status details */ - details?: (google.protobuf.IAny[]|null); - } - - /** Represents a Status. */ - class Status implements IStatus { - - /** - * Constructs a new Status. - * @param [properties] Properties to set - */ - constructor(properties?: google.rpc.IStatus); - - /** Status code. */ - public code: number; - - /** Status message. */ - public message: string; - - /** Status details. */ - public details: google.protobuf.IAny[]; - - /** - * Creates a new Status instance using the specified properties. - * @param [properties] Properties to set - * @returns Status instance - */ - public static create(properties?: google.rpc.IStatus): google.rpc.Status; - - /** - * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @param message Status message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @param message Status message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Status message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Status - * @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.rpc.Status; - - /** - * Decodes a Status message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Status - * @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.rpc.Status; - - /** - * Verifies a Status 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 Status message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Status - */ - public static fromObject(object: { [k: string]: any }): google.rpc.Status; - - /** - * Creates a plain object from a Status message. Also converts values to other types if specified. - * @param message Status - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Status to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Status - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace type. */ - namespace type { - - /** Properties of a Color. */ - interface IColor { - - /** Color red */ - red?: (number|null); - - /** Color green */ - green?: (number|null); - - /** Color blue */ - blue?: (number|null); - - /** Color alpha */ - alpha?: (google.protobuf.IFloatValue|null); - } - - /** Represents a Color. */ - class Color implements IColor { - - /** - * Constructs a new Color. - * @param [properties] Properties to set - */ - constructor(properties?: google.type.IColor); - - /** Color red. */ - public red: number; - - /** Color green. */ - public green: number; - - /** Color blue. */ - public blue: number; - - /** Color alpha. */ - public alpha?: (google.protobuf.IFloatValue|null); - - /** - * Creates a new Color instance using the specified properties. - * @param [properties] Properties to set - * @returns Color instance - */ - public static create(properties?: google.type.IColor): google.type.Color; - - /** - * Encodes the specified Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. - * @param message Color message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.type.IColor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. - * @param message Color message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.type.IColor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Color message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Color - * @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.type.Color; - - /** - * Decodes a Color message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Color - * @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.type.Color; - - /** - * Verifies a Color 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 Color message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Color - */ - public static fromObject(object: { [k: string]: any }): google.type.Color; - - /** - * Creates a plain object from a Color message. Also converts values to other types if specified. - * @param message Color - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.type.Color, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Color to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Color - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LatLng. */ - interface ILatLng { - - /** LatLng latitude */ - latitude?: (number|null); - - /** LatLng longitude */ - longitude?: (number|null); - } - - /** Represents a LatLng. */ - class LatLng implements ILatLng { - - /** - * Constructs a new LatLng. - * @param [properties] Properties to set - */ - constructor(properties?: google.type.ILatLng); - - /** LatLng latitude. */ - public latitude: number; - - /** LatLng longitude. */ - public longitude: number; - - /** - * Creates a new LatLng instance using the specified properties. - * @param [properties] Properties to set - * @returns LatLng instance - */ - public static create(properties?: google.type.ILatLng): google.type.LatLng; - - /** - * Encodes the specified LatLng message. Does not implicitly {@link google.type.LatLng.verify|verify} messages. - * @param message LatLng message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.type.ILatLng, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LatLng message, length delimited. Does not implicitly {@link google.type.LatLng.verify|verify} messages. - * @param message LatLng message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.type.ILatLng, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LatLng message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LatLng - * @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.type.LatLng; - - /** - * Decodes a LatLng message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LatLng - * @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.type.LatLng; - - /** - * Verifies a LatLng 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 LatLng message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LatLng - */ - public static fromObject(object: { [k: string]: any }): google.type.LatLng; - - /** - * Creates a plain object from a LatLng message. Also converts values to other types if specified. - * @param message LatLng - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.type.LatLng, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LatLng to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LatLng - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } -} diff --git a/protos/protos.js b/protos/protos.js deleted file mode 100644 index b3208d5e..00000000 --- a/protos/protos.js +++ /dev/null @@ -1,123702 +0,0 @@ -// Copyright 2023 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. - -/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ -(function(global, factory) { /* global define, require, module */ - - /* AMD */ if (typeof define === 'function' && define.amd) - define(["protobufjs/minimal"], factory); - - /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); - -})(this, function($protobuf) { - "use strict"; - - // Common aliases - var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; - - // Exported root namespace - var $root = $protobuf.roots._google_cloud_vision_protos || ($protobuf.roots._google_cloud_vision_protos = {}); - - $root.google = (function() { - - /** - * Namespace google. - * @exports google - * @namespace - */ - var google = {}; - - google.cloud = (function() { - - /** - * Namespace cloud. - * @memberof google - * @namespace - */ - var cloud = {}; - - cloud.vision = (function() { - - /** - * Namespace vision. - * @memberof google.cloud - * @namespace - */ - var vision = {}; - - vision.v1 = (function() { - - /** - * Namespace v1. - * @memberof google.cloud.vision - * @namespace - */ - var v1 = {}; - - v1.Vertex = (function() { - - /** - * Properties of a Vertex. - * @memberof google.cloud.vision.v1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y - */ - - /** - * Constructs a new Vertex. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a Vertex. - * @implements IVertex - * @constructor - * @param {google.cloud.vision.v1.IVertex=} [properties] Properties to set - */ - 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]]; - } - - /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1.Vertex - * @instance - */ - Vertex.prototype.x = 0; - - /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.vision.v1.Vertex - * @instance - */ - Vertex.prototype.y = 0; - - /** - * Creates a new Vertex instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Vertex - * @static - * @param {google.cloud.vision.v1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Vertex} Vertex instance - */ - Vertex.create = function create(properties) { - return new Vertex(properties); - }; - - /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Vertex - * @static - * @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 - */ - Vertex.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); - return writer; - }; - - /** - * 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.Vertex - * @static - * @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 - */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Vertex message from the specified reader or buffer. - * @function decode - * @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.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.v1.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; - }; - - /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.Vertex - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Vertex.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Vertex message. - * @function verify - * @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 - */ - 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; - }; - - /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.Vertex - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Vertex} Vertex - */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Vertex) - 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; - return message; - }; - - /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.Vertex - * @static - * @param {google.cloud.vision.v1.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.v1.Vertex - * @instance - * @returns {Object.} JSON object - */ - Vertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Vertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Vertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Vertex"; - }; - - return Vertex; - })(); - - v1.NormalizedVertex = (function() { - - /** - * Properties of a NormalizedVertex. - * @memberof google.cloud.vision.v1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y - */ - - /** - * Constructs a new NormalizedVertex. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex - * @constructor - * @param {google.cloud.vision.v1.INormalizedVertex=} [properties] Properties to set - */ - function NormalizedVertex(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]]; - } - - /** - * 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 - * @instance - */ - NormalizedVertex.prototype.y = 0; - - /** - * Creates a new NormalizedVertex instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.NormalizedVertex - * @static - * @param {google.cloud.vision.v1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex instance - */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); - }; - - /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.NormalizedVertex - * @static - * @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 - */ - NormalizedVertex.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - return writer; - }; - - /** - * 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.NormalizedVertex - * @static - * @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 - */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer. - * @function decode - * @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.NormalizedVertex} NormalizedVertex - * @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) { - 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(); - 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; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.NormalizedVertex - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NormalizedVertex message. - * @function verify - * @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 - */ - NormalizedVertex.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"; - return null; - }; - - /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.NormalizedVertex - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex - */ - NormalizedVertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.NormalizedVertex) - 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); - return message; - }; - - /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.NormalizedVertex - * @static - * @param {google.cloud.vision.v1.NormalizedVertex} message NormalizedVertex - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NormalizedVertex.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; - return object; - }; - - /** - * Converts this NormalizedVertex to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.NormalizedVertex - * @instance - * @returns {Object.} JSON object - */ - NormalizedVertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NormalizedVertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1.NormalizedVertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NormalizedVertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.NormalizedVertex"; - }; - - return NormalizedVertex; - })(); - - v1.BoundingPoly = (function() { - - /** - * Properties of a BoundingPoly. - * @memberof google.cloud.vision.v1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices - */ - - /** - * Constructs a new BoundingPoly. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly - * @constructor - * @param {google.cloud.vision.v1.IBoundingPoly=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * 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 - * @instance - */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.BoundingPoly - * @static - * @param {google.cloud.vision.v1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly instance - */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); - }; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.BoundingPoly - * @static - * @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 - */ - BoundingPoly.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(); - return writer; - }; - - /** - * 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.BoundingPoly - * @static - * @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 - */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @function decode - * @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.BoundingPoly} BoundingPoly - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.BoundingPoly - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BoundingPoly message. - * @function verify - * @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 - */ - BoundingPoly.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; - } - } - return null; - }; - - /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.BoundingPoly - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly - */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BoundingPoly) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.BoundingPoly - * @static - * @param {google.cloud.vision.v1.BoundingPoly} message BoundingPoly - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoundingPoly.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); - } - return object; - }; - - /** - * Converts this BoundingPoly to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.BoundingPoly - * @instance - * @returns {Object.} JSON object - */ - BoundingPoly.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BoundingPoly - * @function getTypeUrl - * @memberof google.cloud.vision.v1.BoundingPoly - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.BoundingPoly"; - }; - - return BoundingPoly; - })(); - - v1.Position = (function() { - - /** - * Properties of a Position. - * @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 - */ - - /** - * Constructs a new Position. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a Position. - * @implements IPosition - * @constructor - * @param {google.cloud.vision.v1.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]]; - } - - /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1.Position - * @instance - */ - Position.prototype.x = 0; - - /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1.Position - * @instance - */ - Position.prototype.y = 0; - - /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1.Position - * @instance - */ - Position.prototype.z = 0; - - /** - * 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 - */ - Position.create = function create(properties) { - return new Position(properties); - }; - - /** - * 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 - */ - Position.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && Object.hasOwnProperty.call(message, "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.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 - */ - 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.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 - */ - 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; - }; - - /** - * 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 - */ - 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.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 - */ - Position.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Position - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Position - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Position.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Position"; - }; - - return Position; - })(); - - 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; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1.Likelihood - * @enum {number} - * @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.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.Feature - * @static - * @param {google.cloud.vision.v1.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Feature} Feature instance - */ - Feature.create = function create(properties) { - return new Feature(properties); - }; - - /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1.Feature.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Feature - * @static - * @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 - */ - Feature.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && Object.hasOwnProperty.call(message, "model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); - return writer; - }; - - /** - * 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.Feature - * @static - * @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 - */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Feature message from the specified reader or buffer. - * @function decode - * @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.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.v1.Feature(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type = reader.int32(); - break; - } - case 2: { - message.maxResults = reader.int32(); - break; - } - case 3: { - message.model = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.Feature - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.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.v1.Feature - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Feature} Feature - */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Feature) - return object; - var message = new $root.google.cloud.vision.v1.Feature(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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 Feature message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.Feature - * @static - * @param {google.cloud.vision.v1.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.v1.Feature.Type[message.type] === undefined ? message.type : $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 Feature to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.Feature - * @instance - * @returns {Object.} JSON object - */ - Feature.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Feature - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Feature - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Feature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Feature"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1.Feature.Type - * @enum {number} - * @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; - })(); - - v1.ImageSource = (function() { - - /** - * Properties of an ImageSource. - * @memberof google.cloud.vision.v1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri - */ - - /** - * 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]]; - } - - /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1.ImageSource - * @instance - */ - ImageSource.prototype.gcsImageUri = ""; - - /** - * ImageSource imageUri. - * @member {string} imageUri - * @memberof google.cloud.vision.v1.ImageSource - * @instance - */ - ImageSource.prototype.imageUri = ""; - - /** - * Creates a new ImageSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ImageSource - * @static - * @param {google.cloud.vision.v1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImageSource} ImageSource instance - */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); - }; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1.ImageSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ImageSource - * @static - * @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 - */ - ImageSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsImageUri != null && Object.hasOwnProperty.call(message, "gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); - return writer; - }; - - /** - * 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.ImageSource - * @static - * @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 - */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer. - * @function decode - * @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.ImageSource} ImageSource - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsImageUri = reader.string(); - break; - } - case 2: { - message.imageUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImageSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageSource message. - * @function verify - * @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 - */ - ImageSource.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"; - return null; - }; - - /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ImageSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImageSource} ImageSource - */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImageSource) - 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); - return message; - }; - - /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ImageSource - * @static - * @param {google.cloud.vision.v1.ImageSource} message ImageSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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 ImageSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ImageSource - * @instance - * @returns {Object.} JSON object - */ - ImageSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ImageSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ImageSource"; - }; - - return ImageSource; - })(); - - v1.Image = (function() { - - /** - * Properties of an Image. - * @memberof google.cloud.vision.v1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1.IImageSource|null} [source] Image source - */ - - /** - * Constructs a new Image. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an Image. - * @implements IImage - * @constructor - * @param {google.cloud.vision.v1.IImage=} [properties] Properties to set - */ - function Image(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]]; - } - - /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1.Image - * @instance - */ - Image.prototype.content = $util.newBuffer([]); - - /** - * Image source. - * @member {google.cloud.vision.v1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1.Image - * @instance - */ - Image.prototype.source = null; - - /** - * Creates a new Image instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Image - * @static - * @param {google.cloud.vision.v1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Image} Image instance - */ - Image.create = function create(properties) { - return new Image(properties); - }; - - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1.Image.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Image - * @static - * @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 - */ - Image.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && Object.hasOwnProperty.call(message, "source")) - $root.google.cloud.vision.v1.ImageSource.encode(message.source, 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. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.Image - * @static - * @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 - */ - Image.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Image message from the specified reader or buffer. - * @function decode - * @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.Image} Image - * @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) { - 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(); - 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.v1.ImageSource.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.Image - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Image.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Image message. - * @function verify - * @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 - */ - Image.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; - } - return null; - }; - - /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.Image - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Image} Image - */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Image) - 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 >= 0) - 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 an Image message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.Image - * @static - * @param {google.cloud.vision.v1.Image} message Image - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Image.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 (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. - * @function toJSON - * @memberof google.cloud.vision.v1.Image - * @instance - * @returns {Object.} JSON object - */ - Image.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Image - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Image - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Image.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Image"; - }; - - return Image; - })(); - - v1.FaceAnnotation = (function() { - - /** - * Properties of a FaceAnnotation. - * @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 - */ - - /** - * Constructs a new FaceAnnotation. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation - * @constructor - * @param {google.cloud.vision.v1.IFaceAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * 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 - * @instance - */ - FaceAnnotation.prototype.fdBoundingPoly = null; - - /** - * FaceAnnotation landmarks. - * @member {Array.} landmarks - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarks = $util.emptyArray; - - /** - * FaceAnnotation rollAngle. - * @member {number} rollAngle - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.rollAngle = 0; - - /** - * FaceAnnotation panAngle. - * @member {number} panAngle - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.panAngle = 0; - - /** - * FaceAnnotation tiltAngle. - * @member {number} tiltAngle - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.tiltAngle = 0; - - /** - * FaceAnnotation detectionConfidence. - * @member {number} detectionConfidence - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.detectionConfidence = 0; - - /** - * FaceAnnotation landmarkingConfidence. - * @member {number} landmarkingConfidence - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarkingConfidence = 0; - - /** - * FaceAnnotation joyLikelihood. - * @member {google.cloud.vision.v1.Likelihood} joyLikelihood - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.joyLikelihood = 0; - - /** - * 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.FaceAnnotation - * @static - * @param {google.cloud.vision.v1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation instance - */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); - }; - - /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.FaceAnnotation - * @static - * @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 - */ - FaceAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && Object.hasOwnProperty.call(message, "panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && Object.hasOwnProperty.call(message, "tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && Object.hasOwnProperty.call(message, "detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && Object.hasOwnProperty.call(message, "landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && Object.hasOwnProperty.call(message, "joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && Object.hasOwnProperty.call(message, "sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && Object.hasOwnProperty.call(message, "angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && Object.hasOwnProperty.call(message, "surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && Object.hasOwnProperty.call(message, "underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && Object.hasOwnProperty.call(message, "blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && Object.hasOwnProperty.call(message, "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.v1.FaceAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.FaceAnnotation - * @static - * @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 - */ - 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.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.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.v1.FaceAnnotation(); - 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.fdBoundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); - 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(); - 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.v1.FaceAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.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) { - 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 a FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.FaceAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation - */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.FaceAnnotation) - 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) { - default: - if (typeof object.joyLikelihood === "number") { - message.joyLikelihood = object.joyLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.sorrowLikelihood === "number") { - message.sorrowLikelihood = object.sorrowLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.angerLikelihood === "number") { - message.angerLikelihood = object.angerLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.surpriseLikelihood === "number") { - message.surpriseLikelihood = object.surpriseLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.underExposedLikelihood === "number") { - message.underExposedLikelihood = object.underExposedLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.blurredLikelihood === "number") { - message.blurredLikelihood = object.blurredLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.headwearLikelihood === "number") { - message.headwearLikelihood = object.headwearLikelihood; - break; - } - break; - 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 FaceAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.FaceAnnotation - * @static - * @param {google.cloud.vision.v1.FaceAnnotation} message FaceAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FaceAnnotation.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); - } - 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] === undefined ? message.joyLikelihood : $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] === undefined ? message.sorrowLikelihood : $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] === undefined ? message.angerLikelihood : $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] === undefined ? message.surpriseLikelihood : $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] === undefined ? message.underExposedLikelihood : $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] === undefined ? message.blurredLikelihood : $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] === undefined ? message.headwearLikelihood : $root.google.cloud.vision.v1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; - return object; - }; - - /** - * Converts this FaceAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - * @returns {Object.} JSON object - */ - FaceAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FaceAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1.FaceAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FaceAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.FaceAnnotation"; - }; - - 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 - */ - - /** - * 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]]; - } - - /** - * Landmark type. - * @member {google.cloud.vision.v1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 0; - - /** - * Landmark position. - * @member {google.cloud.vision.v1.IPosition|null|undefined} position - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.position = null; - - /** - * 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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && Object.hasOwnProperty.call(message, "position")) - $root.google.cloud.vision.v1.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.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: - case 35: - case 36: - 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) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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; - case "LEFT_CHEEK_CENTER": - case 35: - message.type = 35; - break; - case "RIGHT_CHEEK_CENTER": - case 36: - message.type = 36; - 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] === undefined ? message.type : $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); - }; - - /** - * Gets the default type url for Landmark - * @function getTypeUrl - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Landmark.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.FaceAnnotation.Landmark"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1.FaceAnnotation.Landmark.Type - * @enum {number} - * @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 - * @property {number} LEFT_CHEEK_CENTER=35 LEFT_CHEEK_CENTER value - * @property {number} RIGHT_CHEEK_CENTER=36 RIGHT_CHEEK_CENTER 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; - values[valuesById[35] = "LEFT_CHEEK_CENTER"] = 35; - values[valuesById[36] = "RIGHT_CHEEK_CENTER"] = 36; - 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; - - /** - * 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 && Object.hasOwnProperty.call(message, "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 LocationInfo message. - * @function verify - * @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 - */ - 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.v1.LocationInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo - */ - LocationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.LocationInfo) - 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); - } - return message; - }; - - /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.LocationInfo - * @static - * @param {google.cloud.vision.v1.LocationInfo} message LocationInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LocationInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.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.v1.LocationInfo - * @instance - * @returns {Object.} JSON object - */ - LocationInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocationInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1.LocationInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.LocationInfo"; - }; - - return LocationInfo; - })(); - - v1.Property = (function() { - - /** - * Properties of a Property. - * @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 - */ - - /** - * Constructs a new Property. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a Property. - * @implements IProperty - * @constructor - * @param {google.cloud.vision.v1.IProperty=} [properties] Properties to set - */ - function Property(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * Property value. - * @member {string} value - * @memberof google.cloud.vision.v1.Property - * @instance - */ - Property.prototype.value = ""; - - /** - * Property uint64Value. - * @member {number|Long} uint64Value - * @memberof google.cloud.vision.v1.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.v1.Property - * @static - * @param {google.cloud.vision.v1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Property} Property instance - */ - Property.create = function create(properties) { - return new Property(properties); - }; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1.Property.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Property - * @static - * @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 - */ - Property.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && Object.hasOwnProperty.call(message, "uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); - return writer; - }; - - /** - * 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.Property - * @static - * @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 - */ - Property.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Property message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.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.Property} Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Property.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.Property(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - case 3: { - message.uint64Value = reader.uint64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.Property - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Property.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Property message. - * @function verify - * @memberof google.cloud.vision.v1.Property - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Property.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.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 Property message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.Property - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Property} Property - */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Property) - 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); - return message; - }; - - /** - * Creates a plain object from a Property message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.Property - * @static - * @param {google.cloud.vision.v1.Property} message Property - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Property.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.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 Property to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.Property - * @instance - * @returns {Object.} JSON object - */ - Property.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Property - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Property - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Property"; - }; - - return Property; - })(); - - v1.EntityAnnotation = (function() { - - /** - * Properties of an EntityAnnotation. - * @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 - */ - - /** - * Constructs a new EntityAnnotation. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation - * @constructor - * @param {google.cloud.vision.v1.IEntityAnnotation=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.mid = ""; - - /** - * EntityAnnotation locale. - * @member {string} locale - * @memberof google.cloud.vision.v1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.locale = ""; - - /** - * 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.EntityAnnotation - * @static - * @param {google.cloud.vision.v1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation instance - */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); - }; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1.EntityAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.EntityAnnotation - * @static - * @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 - */ - EntityAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && Object.hasOwnProperty.call(message, "locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && Object.hasOwnProperty.call(message, "topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "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 EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.EntityAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.EntityAnnotation - * @static - * @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 - */ - EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer. - * @function decode - * @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.EntityAnnotation} EntityAnnotation - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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.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); - break; - } - } - return message; - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.EntityAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.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.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 an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.EntityAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation - */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.EntityAnnotation) - 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); - 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.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 an EntityAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.EntityAnnotation - * @static - * @param {google.cloud.vision.v1.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.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); - } - return object; - }; - - /** - * Converts this EntityAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.EntityAnnotation - * @instance - * @returns {Object.} JSON object - */ - EntityAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EntityAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1.EntityAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EntityAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.EntityAnnotation"; - }; - - return EntityAnnotation; - })(); - - v1.LocalizedObjectAnnotation = (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 - */ - - /** - * 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]]; - } - - /** - * LocalizedObjectAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.mid = ""; - - /** - * 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.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.score = 0; - - /** - * LocalizedObjectAnnotation boundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.boundingPoly = null; - - /** - * 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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * 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(); - }; - - /** - * 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) { - case 1: { - 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.v1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - 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 - */ - 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.v1.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.v1.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.v1.LocalizedObjectAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation - */ - LocalizedObjectAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.LocalizedObjectAnnotation) - 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); - } - return message; - }; - - /** - * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1.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.v1.BoundingPoly.toObject(message.boundingPoly, options); - return object; - }; - - /** - * Converts this LocalizedObjectAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @instance - * @returns {Object.} JSON object - */ - LocalizedObjectAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocalizedObjectAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocalizedObjectAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.LocalizedObjectAnnotation"; - }; - - return LocalizedObjectAnnotation; - })(); - - v1.SafeSearchAnnotation = (function() { - - /** - * Properties of a SafeSearchAnnotation. - * @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 - */ - - /** - * Constructs a new SafeSearchAnnotation. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation - * @constructor - * @param {google.cloud.vision.v1.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.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; - - /** - * 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 - */ - SafeSearchAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.adult != null && Object.hasOwnProperty.call(message, "adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && Object.hasOwnProperty.call(message, "spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && Object.hasOwnProperty.call(message, "medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && Object.hasOwnProperty.call(message, "violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && Object.hasOwnProperty.call(message, "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.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 SafeSearchAnnotation message from the specified reader or buffer. - * @function decode - * @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.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.v1.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; - }; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.v1.SafeSearchAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation - */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.SafeSearchAnnotation) - return object; - var message = new $root.google.cloud.vision.v1.SafeSearchAnnotation(); - switch (object.adult) { - default: - if (typeof object.adult === "number") { - message.adult = object.adult; - break; - } - break; - 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) { - default: - if (typeof object.spoof === "number") { - message.spoof = object.spoof; - break; - } - break; - 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) { - default: - if (typeof object.medical === "number") { - message.medical = object.medical; - break; - } - break; - 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) { - default: - if (typeof object.violence === "number") { - message.violence = object.violence; - break; - } - break; - 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) { - default: - if (typeof object.racy === "number") { - message.racy = object.racy; - break; - } - break; - 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 SafeSearchAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1.SafeSearchAnnotation} message SafeSearchAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SafeSearchAnnotation.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.v1.Likelihood[message.adult] === undefined ? message.adult : $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] === undefined ? message.spoof : $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] === undefined ? message.medical : $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] === undefined ? message.violence : $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] === undefined ? message.racy : $root.google.cloud.vision.v1.Likelihood[message.racy] : message.racy; - return object; - }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - * @returns {Object.} JSON object - */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SafeSearchAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.SafeSearchAnnotation"; - }; - - return SafeSearchAnnotation; - })(); - - v1.LatLongRect = (function() { - - /** - * Properties of a LatLongRect. - * @memberof google.cloud.vision.v1 - * @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.v1 - * @classdesc Represents a LatLongRect. - * @implements ILatLongRect - * @constructor - * @param {google.cloud.vision.v1.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.v1.LatLongRect - * @instance - */ - LatLongRect.prototype.minLatLng = null; - - /** - * LatLongRect maxLatLng. - * @member {google.type.ILatLng|null|undefined} maxLatLng - * @memberof google.cloud.vision.v1.LatLongRect - * @instance - */ - 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 LatLongRect message. Does not implicitly {@link google.cloud.vision.v1.LatLongRect.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.LatLongRect - * @static - * @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 - */ - LatLongRect.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minLatLng != null && Object.hasOwnProperty.call(message, "minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && Object.hasOwnProperty.call(message, "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.v1.LatLongRect.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.LatLongRect - * @static - * @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 - */ - 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.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.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.v1.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.v1.LatLongRect - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.v1.LatLongRect - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect - */ - LatLongRect.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.LatLongRect) - 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); - } - 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 a LatLongRect message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.LatLongRect - * @static - * @param {google.cloud.vision.v1.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 LatLongRect to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.LatLongRect - * @instance - * @returns {Object.} JSON object - */ - LatLongRect.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LatLongRect - * @function getTypeUrl - * @memberof google.cloud.vision.v1.LatLongRect - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LatLongRect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.LatLongRect"; - }; - - return LatLongRect; - })(); - - v1.ColorInfo = (function() { - - /** - * Properties of a ColorInfo. - * @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 - */ - - /** - * Constructs a new ColorInfo. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo - * @constructor - * @param {google.cloud.vision.v1.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]]; - } - - /** - * ColorInfo color. - * @member {google.type.IColor|null|undefined} color - * @memberof google.cloud.vision.v1.ColorInfo - * @instance - */ - ColorInfo.prototype.color = null; - - /** - * ColorInfo score. - * @member {number} score - * @memberof google.cloud.vision.v1.ColorInfo - * @instance - */ - ColorInfo.prototype.score = 0; - - /** - * ColorInfo pixelFraction. - * @member {number} pixelFraction - * @memberof google.cloud.vision.v1.ColorInfo - * @instance - */ - ColorInfo.prototype.pixelFraction = 0; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ColorInfo - * @static - * @param {google.cloud.vision.v1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo instance - */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); - }; - - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1.ColorInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ColorInfo - * @static - * @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 - */ - ColorInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.color != null && Object.hasOwnProperty.call(message, "color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && Object.hasOwnProperty.call(message, "pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); - return writer; - }; - - /** - * 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.ColorInfo - * @static - * @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 - */ - ColorInfo.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.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.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.v1.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; - } - } - return message; - }; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ColorInfo.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.v1.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; - }; - - /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ColorInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo - */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ColorInfo) - 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); - } - 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.v1.ColorInfo - * @static - * @param {google.cloud.vision.v1.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 ColorInfo to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ColorInfo - * @instance - * @returns {Object.} JSON object - */ - ColorInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ColorInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ColorInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ColorInfo"; - }; - - return ColorInfo; - })(); - - v1.DominantColorsAnnotation = (function() { - - /** - * Properties of a DominantColorsAnnotation. - * @memberof google.cloud.vision.v1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors - */ - - /** - * Constructs a new DominantColorsAnnotation. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation - * @constructor - * @param {google.cloud.vision.v1.IDominantColorsAnnotation=} [properties] Properties to set - */ - function DominantColorsAnnotation(properties) { - this.colors = []; - 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]]; - } - - /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @instance - */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; - - /** - * 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 - */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); - }; - - /** - * 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 - */ - 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; - }; - - /** - * 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 - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. - * @function decode - * @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.DominantColorsAnnotation} DominantColorsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DominantColorsAnnotation message. - * @function verify - * @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 - */ - DominantColorsAnnotation.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; - } - } - return null; - }; - - /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation - */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.DominantColorsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1.DominantColorsAnnotation} message DominantColorsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DominantColorsAnnotation.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); - } - return object; - }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @instance - * @returns {Object.} JSON object - */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DominantColorsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.DominantColorsAnnotation"; - }; - - return DominantColorsAnnotation; - })(); - - v1.ImageProperties = (function() { - - /** - * Properties of an ImageProperties. - * @memberof google.cloud.vision.v1 - * @interface IImageProperties - * @property {google.cloud.vision.v1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors - */ - - /** - * Constructs a new ImageProperties. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties - * @constructor - * @param {google.cloud.vision.v1.IImageProperties=} [properties] Properties to set - */ - 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]]; - } - - /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1.ImageProperties - * @instance - */ - ImageProperties.prototype.dominantColors = 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 - */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); - }; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1.ImageProperties.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ImageProperties - * @static - * @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 - */ - ImageProperties.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dominantColors != null && Object.hasOwnProperty.call(message, "dominantColors")) - $root.google.cloud.vision.v1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageProperties - * @static - * @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 - */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer. - * @function decode - * @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.ImageProperties} ImageProperties - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImageProperties - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageProperties message. - * @function verify - * @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 - */ - ImageProperties.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 (error) - return "dominantColors." + error; - } - return null; - }; - - /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ImageProperties - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties - */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImageProperties) - 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); - } - return message; - }; - - /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ImageProperties - * @static - * @param {google.cloud.vision.v1.ImageProperties} message ImageProperties - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageProperties.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); - return object; - }; - - /** - * Converts this ImageProperties to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ImageProperties - * @instance - * @returns {Object.} JSON object - */ - ImageProperties.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageProperties - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ImageProperties - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ImageProperties"; - }; - - return ImageProperties; - })(); - - v1.CropHint = (function() { - - /** - * Properties of a CropHint. - * @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 - */ - - /** - * Constructs a new CropHint. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a CropHint. - * @implements ICropHint - * @constructor - * @param {google.cloud.vision.v1.ICropHint=} [properties] Properties to set - */ - function CropHint(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]]; - } - - /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1.CropHint - * @instance - */ - CropHint.prototype.boundingPoly = null; - - /** - * 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.CropHint - * @static - * @param {google.cloud.vision.v1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CropHint} CropHint instance - */ - CropHint.create = function create(properties) { - return new CropHint(properties); - }; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1.CropHint.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.CropHint - * @static - * @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 - */ - CropHint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && Object.hasOwnProperty.call(message, "importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); - return writer; - }; - - /** - * 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.CropHint - * @static - * @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 - */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHint message from the specified reader or buffer. - * @function decode - * @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.CropHint} CropHint - * @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) { - 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(); - 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.confidence = reader.float(); - break; - } - case 3: { - message.importanceFraction = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.CropHint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHint message. - * @function verify - * @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 - */ - CropHint.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.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. - * @function fromObject - * @memberof google.cloud.vision.v1.CropHint - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CropHint} CropHint - */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CropHint) - 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); - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1.CropHint - * @static - * @param {google.cloud.vision.v1.CropHint} message CropHint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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 CropHint to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.CropHint - * @instance - * @returns {Object.} JSON object - */ - CropHint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHint - * @function getTypeUrl - * @memberof google.cloud.vision.v1.CropHint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.CropHint"; - }; - - return CropHint; - })(); - - v1.CropHintsAnnotation = (function() { - - /** - * Properties of a CropHintsAnnotation. - * @memberof google.cloud.vision.v1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints - */ - - /** - * Constructs a new CropHintsAnnotation. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation - * @constructor - * @param {google.cloud.vision.v1.ICropHintsAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1.CropHintsAnnotation - * @instance - */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation instance - */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); - }; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1.CropHintsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.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(); - return writer; - }; - - /** - * 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.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. - * @function decode - * @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.CropHintsAnnotation} CropHintsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.CropHintsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsAnnotation message. - * @function verify - * @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 - */ - CropHintsAnnotation.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 (error) - return "cropHints." + error; - } - } - return null; - }; - - /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.CropHintsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation - */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CropHintsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1.CropHintsAnnotation} message CropHintsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsAnnotation.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); - } - return object; - }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.CropHintsAnnotation - * @instance - * @returns {Object.} JSON object - */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1.CropHintsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.CropHintsAnnotation"; - }; - - return CropHintsAnnotation; - })(); - - v1.CropHintsParams = (function() { - - /** - * Properties of a CropHintsParams. - * @memberof google.cloud.vision.v1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios - */ - - /** - * Constructs a new CropHintsParams. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams - * @constructor - * @param {google.cloud.vision.v1.ICropHintsParams=} [properties] Properties to set - */ - function CropHintsParams(properties) { - this.aspectRatios = []; - 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]]; - } - - /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1.CropHintsParams - * @instance - */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.CropHintsParams - * @static - * @param {google.cloud.vision.v1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams instance - */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); - }; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1.CropHintsParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.CropHintsParams - * @static - * @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 - */ - CropHintsParams.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(); - } - return writer; - }; - - /** - * 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.CropHintsParams - * @static - * @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 - */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer. - * @function decode - * @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.CropHintsParams} CropHintsParams - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.CropHintsParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsParams message. - * @function verify - * @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 - */ - CropHintsParams.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"; - } - return null; - }; - - /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.CropHintsParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams - */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CropHintsParams) - 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]); - } - return message; - }; - - /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.CropHintsParams - * @static - * @param {google.cloud.vision.v1.CropHintsParams} message CropHintsParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsParams.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]; - } - return object; - }; - - /** - * Converts this CropHintsParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.CropHintsParams - * @instance - * @returns {Object.} JSON object - */ - CropHintsParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1.CropHintsParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.CropHintsParams"; - }; - - return CropHintsParams; - })(); - - v1.WebDetectionParams = (function() { - - /** - * Properties of a WebDetectionParams. - * @memberof google.cloud.vision.v1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults - */ - - /** - * Constructs a new WebDetectionParams. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams - * @constructor - * @param {google.cloud.vision.v1.IWebDetectionParams=} [properties] Properties to set - */ - function WebDetectionParams(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]]; - } - - /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1.WebDetectionParams - * @instance - */ - WebDetectionParams.prototype.includeGeoResults = false; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams instance - */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); - }; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1.WebDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.includeGeoResults != null && Object.hasOwnProperty.call(message, "includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); - return writer; - }; - - /** - * 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.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer. - * @function decode - * @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.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.v1.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.v1.WebDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.WebDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams - */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.WebDetectionParams) - return object; - 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 a WebDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1.WebDetectionParams} message WebDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebDetectionParams.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; - return object; - }; - - /** - * Converts this WebDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.WebDetectionParams - * @instance - * @returns {Object.} JSON object - */ - WebDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1.WebDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.WebDetectionParams"; - }; - - return WebDetectionParams; - })(); - - v1.TextDetectionParams = (function() { - - /** - * Properties of a TextDetectionParams. - * @memberof google.cloud.vision.v1 - * @interface ITextDetectionParams - * @property {boolean|null} [enableTextDetectionConfidenceScore] TextDetectionParams enableTextDetectionConfidenceScore - * @property {Array.|null} [advancedOcrOptions] TextDetectionParams advancedOcrOptions - */ - - /** - * Constructs a new TextDetectionParams. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a TextDetectionParams. - * @implements ITextDetectionParams - * @constructor - * @param {google.cloud.vision.v1.ITextDetectionParams=} [properties] Properties to set - */ - function TextDetectionParams(properties) { - this.advancedOcrOptions = []; - 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]]; - } - - /** - * TextDetectionParams enableTextDetectionConfidenceScore. - * @member {boolean} enableTextDetectionConfidenceScore - * @memberof google.cloud.vision.v1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.enableTextDetectionConfidenceScore = false; - - /** - * TextDetectionParams advancedOcrOptions. - * @member {Array.} advancedOcrOptions - * @memberof google.cloud.vision.v1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.advancedOcrOptions = $util.emptyArray; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1.ITextDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1.TextDetectionParams} TextDetectionParams instance - */ - TextDetectionParams.create = function create(properties) { - return new TextDetectionParams(properties); - }; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1.TextDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enableTextDetectionConfidenceScore != null && Object.hasOwnProperty.call(message, "enableTextDetectionConfidenceScore")) - writer.uint32(/* id 9, wireType 0 =*/72).bool(message.enableTextDetectionConfidenceScore); - if (message.advancedOcrOptions != null && message.advancedOcrOptions.length) - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.advancedOcrOptions[i]); - return writer; - }; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.TextDetectionParams.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.TextDetectionParams - * @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.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decode = function decode(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.TextDetectionParams(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 9: { - message.enableTextDetectionConfidenceScore = reader.bool(); - break; - } - case 11: { - if (!(message.advancedOcrOptions && message.advancedOcrOptions.length)) - message.advancedOcrOptions = []; - message.advancedOcrOptions.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.TextDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TextDetectionParams message. - * @function verify - * @memberof google.cloud.vision.v1.TextDetectionParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TextDetectionParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - if (typeof message.enableTextDetectionConfidenceScore !== "boolean") - return "enableTextDetectionConfidenceScore: boolean expected"; - if (message.advancedOcrOptions != null && message.hasOwnProperty("advancedOcrOptions")) { - if (!Array.isArray(message.advancedOcrOptions)) - return "advancedOcrOptions: array expected"; - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - if (!$util.isString(message.advancedOcrOptions[i])) - return "advancedOcrOptions: string[] expected"; - } - return null; - }; - - /** - * Creates a TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.TextDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.TextDetectionParams} TextDetectionParams - */ - TextDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.TextDetectionParams) - return object; - var message = new $root.google.cloud.vision.v1.TextDetectionParams(); - if (object.enableTextDetectionConfidenceScore != null) - message.enableTextDetectionConfidenceScore = Boolean(object.enableTextDetectionConfidenceScore); - if (object.advancedOcrOptions) { - if (!Array.isArray(object.advancedOcrOptions)) - throw TypeError(".google.cloud.vision.v1.TextDetectionParams.advancedOcrOptions: array expected"); - message.advancedOcrOptions = []; - for (var i = 0; i < object.advancedOcrOptions.length; ++i) - message.advancedOcrOptions[i] = String(object.advancedOcrOptions[i]); - } - return message; - }; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1.TextDetectionParams} message TextDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TextDetectionParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.advancedOcrOptions = []; - if (options.defaults) - object.enableTextDetectionConfidenceScore = false; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - object.enableTextDetectionConfidenceScore = message.enableTextDetectionConfidenceScore; - if (message.advancedOcrOptions && message.advancedOcrOptions.length) { - object.advancedOcrOptions = []; - for (var j = 0; j < message.advancedOcrOptions.length; ++j) - object.advancedOcrOptions[j] = message.advancedOcrOptions[j]; - } - return object; - }; - - /** - * Converts this TextDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.TextDetectionParams - * @instance - * @returns {Object.} JSON object - */ - TextDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1.TextDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.TextDetectionParams"; - }; - - return TextDetectionParams; - })(); - - v1.ImageContext = (function() { - - /** - * Properties of an ImageContext. - * @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 - * @property {google.cloud.vision.v1.ITextDetectionParams|null} [textDetectionParams] ImageContext textDetectionParams - */ - - /** - * Constructs a new ImageContext. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImageContext. - * @implements IImageContext - * @constructor - * @param {google.cloud.vision.v1.IImageContext=} [properties] Properties to set - */ - function ImageContext(properties) { - this.languageHints = []; - 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]]; - } - - /** - * 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 - * @instance - */ - ImageContext.prototype.webDetectionParams = null; - - /** - * ImageContext textDetectionParams. - * @member {google.cloud.vision.v1.ITextDetectionParams|null|undefined} textDetectionParams - * @memberof google.cloud.vision.v1.ImageContext - * @instance - */ - ImageContext.prototype.textDetectionParams = null; - - /** - * Creates a new ImageContext instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ImageContext - * @static - * @param {google.cloud.vision.v1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImageContext} ImageContext instance - */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); - }; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1.ImageContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ImageContext - * @static - * @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 - */ - ImageContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLongRect != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "cropHintsParams")) - $root.google.cloud.vision.v1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.productSearchParams != null && Object.hasOwnProperty.call(message, "productSearchParams")) - $root.google.cloud.vision.v1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.webDetectionParams != null && Object.hasOwnProperty.call(message, "webDetectionParams")) - $root.google.cloud.vision.v1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.textDetectionParams != null && Object.hasOwnProperty.call(message, "textDetectionParams")) - $root.google.cloud.vision.v1.TextDetectionParams.encode(message.textDetectionParams, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageContext - * @static - * @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 - */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer. - * @function decode - * @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.ImageContext} ImageContext - * @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) { - 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(); - 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()); - break; - } - case 12: { - message.textDetectionParams = $root.google.cloud.vision.v1.TextDetectionParams.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImageContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageContext message. - * @function verify - * @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 - */ - ImageContext.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.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) { - var error = $root.google.cloud.vision.v1.TextDetectionParams.verify(message.textDetectionParams); - if (error) - return "textDetectionParams." + error; - } - return null; - }; - - /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ImageContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImageContext} ImageContext - */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImageContext) - 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); - } - if (object.textDetectionParams != null) { - if (typeof object.textDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1.ImageContext.textDetectionParams: object expected"); - message.textDetectionParams = $root.google.cloud.vision.v1.TextDetectionParams.fromObject(object.textDetectionParams); - } - return message; - }; - - /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ImageContext - * @static - * @param {google.cloud.vision.v1.ImageContext} message ImageContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageContext.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.textDetectionParams = 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]; - } - 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); - if (message.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) - object.textDetectionParams = $root.google.cloud.vision.v1.TextDetectionParams.toObject(message.textDetectionParams, options); - return object; - }; - - /** - * Converts this ImageContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ImageContext - * @instance - * @returns {Object.} JSON object - */ - ImageContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ImageContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ImageContext"; - }; - - return ImageContext; - })(); - - v1.AnnotateImageRequest = (function() { - - /** - * Properties of an AnnotateImageRequest. - * @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 - */ - - /** - * Constructs a new AnnotateImageRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest - * @constructor - * @param {google.cloud.vision.v1.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.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 - * @instance - */ - AnnotateImageRequest.prototype.imageContext = null; - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest instance - */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); - }; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.image != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. - * @function decode - * @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.AnnotateImageRequest} AnnotateImageRequest - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateImageRequest message. - * @function verify - * @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 - */ - AnnotateImageRequest.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; - } - return null; - }; - - /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest - */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AnnotateImageRequest) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1.AnnotateImageRequest} message AnnotateImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateImageRequest.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); - } - 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. - * @function toJSON - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AnnotateImageRequest"; - }; - - return AnnotateImageRequest; - })(); - - v1.ImageAnnotationContext = (function() { - - /** - * Properties of an ImageAnnotationContext. - * @memberof google.cloud.vision.v1 - * @interface IImageAnnotationContext - * @property {string|null} [uri] ImageAnnotationContext uri - * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber - */ - - /** - * Constructs a new ImageAnnotationContext. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImageAnnotationContext. - * @implements IImageAnnotationContext - * @constructor - * @param {google.cloud.vision.v1.IImageAnnotationContext=} [properties] Properties to set - */ - function ImageAnnotationContext(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]]; - } - - /** - * 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 - * @instance - */ - ImageAnnotationContext.prototype.pageNumber = 0; - - /** - * Creates a new ImageAnnotationContext instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ImageAnnotationContext - * @static - * @param {google.cloud.vision.v1.IImageAnnotationContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext instance - */ - ImageAnnotationContext.create = function create(properties) { - return new ImageAnnotationContext(properties); - }; - - /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1.ImageAnnotationContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ImageAnnotationContext - * @static - * @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 - */ - ImageAnnotationContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); - return writer; - }; - - /** - * 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.ImageAnnotationContext - * @static - * @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 - */ - ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. - * @function decode - * @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.ImageAnnotationContext} ImageAnnotationContext - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } - case 2: { - message.pageNumber = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImageAnnotationContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageAnnotationContext message. - * @function verify - * @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 - */ - ImageAnnotationContext.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"; - return null; - }; - - /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ImageAnnotationContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext - */ - ImageAnnotationContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImageAnnotationContext) - 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; - return message; - }; - - /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ImageAnnotationContext - * @static - * @param {google.cloud.vision.v1.ImageAnnotationContext} message ImageAnnotationContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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 ImageAnnotationContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ImageAnnotationContext - * @instance - * @returns {Object.} JSON object - */ - ImageAnnotationContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageAnnotationContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ImageAnnotationContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageAnnotationContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ImageAnnotationContext"; - }; - - return ImageAnnotationContext; - })(); - - v1.AnnotateImageResponse = (function() { - - /** - * Properties of an AnnotateImageResponse. - * @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 - */ - - /** - * Constructs a new AnnotateImageResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse - * @constructor - * @param {google.cloud.vision.v1.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.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse landmarkAnnotations. - * @member {Array.} landmarkAnnotations - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse logoAnnotations. - * @member {Array.} logoAnnotations - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @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; - - /** - * AnnotateImageResponse error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.error = null; - - /** - * AnnotateImageResponse context. - * @member {google.cloud.vision.v1.IImageAnnotationContext|null|undefined} context - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.context = null; - - /** - * Creates a new AnnotateImageResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse instance - */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); - }; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.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 && Object.hasOwnProperty.call(message, "safeSearchAnnotation")) - $root.google.cloud.vision.v1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && Object.hasOwnProperty.call(message, "imagePropertiesAnnotation")) - $root.google.cloud.vision.v1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && Object.hasOwnProperty.call(message, "cropHintsAnnotation")) - $root.google.cloud.vision.v1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && Object.hasOwnProperty.call(message, "fullTextAnnotation")) - $root.google.cloud.vision.v1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && Object.hasOwnProperty.call(message, "webDetection")) - $root.google.cloud.vision.v1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.productSearchResults != null && Object.hasOwnProperty.call(message, "productSearchResults")) - $root.google.cloud.vision.v1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.context != null && Object.hasOwnProperty.call(message, "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 AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. - * @function decode - * @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.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.v1.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.v1.FaceAnnotation.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())); - 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; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.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 (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.AnnotateImageResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse - */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AnnotateImageResponse) - 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); - } - 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.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 AnnotateImageResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1.AnnotateImageResponse} message AnnotateImageResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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 = []; - 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.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); - } - return object; - }; - - /** - * Converts this AnnotateImageResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AnnotateImageResponse"; - }; - - return AnnotateImageResponse; - })(); - - v1.BatchAnnotateImagesRequest = (function() { - - /** - * Properties of a BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests - * @property {string|null} [parent] BatchAnnotateImagesRequest parent - */ - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest - * @constructor - * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest=} [properties] Properties to set - */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @instance - */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; - - /** - * BatchAnnotateImagesRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @instance - */ - BatchAnnotateImagesRequest.prototype.parent = ""; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance - */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @static - * @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 - */ - 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.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); - return writer; - }; - - /** - * 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.BatchAnnotateImagesRequest - * @static - * @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 - */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - * @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) { - 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(); - 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 4: { - message.parent = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateImagesRequest message. - * @function verify - * @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 - */ - 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.AnnotateImageRequest.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 BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateImagesRequest) - 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]); - } - } - if (object.parent != null) - message.parent = String(object.parent); - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchAnnotateImagesRequest.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); - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - return object; - }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.BatchAnnotateImagesRequest"; - }; - - return BatchAnnotateImagesRequest; - })(); - - v1.BatchAnnotateImagesResponse = (function() { - - /** - * Properties of a BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses - */ - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse - * @constructor - * @param {google.cloud.vision.v1.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]]; - } - - /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse - * @instance - */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance - */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse - * @static - * @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 - */ - 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.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.v1.BatchAnnotateImagesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse - * @static - * @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 - */ - 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.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.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.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.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.v1.BatchAnnotateImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.v1.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.v1.BatchAnnotateImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse - */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateImagesResponse) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1.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.v1.AnnotateImageResponse.toObject(message.responses[j], options); - } - return object; - }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.BatchAnnotateImagesResponse"; - }; - - return BatchAnnotateImagesResponse; - })(); - - v1.AnnotateFileRequest = (function() { - - /** - * Properties of an AnnotateFileRequest. - * @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 - */ - - /** - * Constructs a new AnnotateFileRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AnnotateFileRequest. - * @implements IAnnotateFileRequest - * @constructor - * @param {google.cloud.vision.v1.IAnnotateFileRequest=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @instance - */ - AnnotateFileRequest.prototype.inputConfig = null; - - /** - * AnnotateFileRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @instance - */ - AnnotateFileRequest.prototype.features = $util.emptyArray; - - /** - * AnnotateFileRequest imageContext. - * @member {google.cloud.vision.v1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @instance - */ - AnnotateFileRequest.prototype.imageContext = null; - - /** - * AnnotateFileRequest pages. - * @member {Array.} pages - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @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 && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "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()); - }; - - /** - * 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 - */ - 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; - }; - - /** - * 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 - */ - 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; - }; - - /** - * 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 - */ - 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; - }; - - /** - * Converts this AnnotateFileRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @instance - * @returns {Object.} JSON object - */ - AnnotateFileRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateFileRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateFileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AnnotateFileRequest"; - }; - - return AnnotateFileRequest; - })(); - - v1.AnnotateFileResponse = (function() { - - /** - * 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 - */ - - /** - * 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 - */ - 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]]; - } - - /** - * AnnotateFileResponse inputConfig. - * @member {google.cloud.vision.v1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1.AnnotateFileResponse - * @instance - */ - AnnotateFileResponse.prototype.inputConfig = null; - - /** - * 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.AnnotateFileResponse - * @static - * @param {google.cloud.vision.v1.IAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse instance - */ - AnnotateFileResponse.create = function create(properties) { - return new AnnotateFileResponse(properties); - }; - - /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AnnotateFileResponse - * @static - * @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 - */ - AnnotateFileResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "totalPages")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalPages); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateFileResponse - * @static - * @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 - */ - AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. - * @function decode - * @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.AnnotateFileResponse} AnnotateFileResponse - * @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) { - 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(); - 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.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); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AnnotateFileResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateFileResponse message. - * @function verify - * @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 - */ - AnnotateFileResponse.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 (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 AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AnnotateFileResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse - */ - AnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AnnotateFileResponse) - 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); - } - 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 AnnotateFileResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AnnotateFileResponse - * @static - * @param {google.cloud.vision.v1.AnnotateFileResponse} message AnnotateFileResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateFileResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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 AnnotateFileResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AnnotateFileResponse - * @instance - * @returns {Object.} JSON object - */ - AnnotateFileResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateFileResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AnnotateFileResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateFileResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AnnotateFileResponse"; - }; - - return AnnotateFileResponse; - })(); - - v1.BatchAnnotateFilesRequest = (function() { - - /** - * Properties of a BatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1 - * @interface IBatchAnnotateFilesRequest - * @property {Array.|null} [requests] BatchAnnotateFilesRequest requests - * @property {string|null} [parent] BatchAnnotateFilesRequest parent - */ - - /** - * Constructs a new BatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchAnnotateFilesRequest. - * @implements IBatchAnnotateFilesRequest - * @constructor - * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest=} [properties] Properties to set - */ - function BatchAnnotateFilesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * BatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @instance - */ - BatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; - - /** - * BatchAnnotateFilesRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @instance - */ - BatchAnnotateFilesRequest.prototype.parent = ""; - - /** - * Creates a new BatchAnnotateFilesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest instance - */ - BatchAnnotateFilesRequest.create = function create(properties) { - return new BatchAnnotateFilesRequest(properties); - }; - - /** - * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @static - * @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 - */ - 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.AnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.parent); - return writer; - }; - - /** - * 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.BatchAnnotateFilesRequest - * @static - * @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 - */ - BatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest - * @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) { - 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(); - 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())); - break; - } - case 3: { - message.parent = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateFilesRequest message. - * @function verify - * @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 - */ - 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.AnnotateFileRequest.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 BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest - */ - BatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateFilesRequest) - return object; - var message = new $root.google.cloud.vision.v1.BatchAnnotateFilesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - 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.BatchAnnotateFilesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1.AnnotateFileRequest.fromObject(object.requests[i]); - } - } - if (object.parent != null) - message.parent = String(object.parent); - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateFilesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1.BatchAnnotateFilesRequest} message BatchAnnotateFilesRequest - * @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 (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.AnnotateFileRequest.toObject(message.requests[j], options); - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - return object; - }; - - /** - * Converts this BatchAnnotateFilesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateFilesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateFilesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.BatchAnnotateFilesRequest"; - }; - - return BatchAnnotateFilesRequest; - })(); - - v1.BatchAnnotateFilesResponse = (function() { - - /** - * Properties of a BatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1 - * @interface IBatchAnnotateFilesResponse - * @property {Array.|null} [responses] BatchAnnotateFilesResponse responses - */ - - /** - * Constructs a new BatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchAnnotateFilesResponse. - * @implements IBatchAnnotateFilesResponse - * @constructor - * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse=} [properties] Properties to set - */ - function BatchAnnotateFilesResponse(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]]; - } - - /** - * BatchAnnotateFilesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @instance - */ - BatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new BatchAnnotateFilesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse instance - */ - BatchAnnotateFilesResponse.create = function create(properties) { - return new BatchAnnotateFilesResponse(properties); - }; - - /** - * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @static - * @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 - */ - 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.v1.AnnotateFileResponse.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. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @static - * @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 - */ - BatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateFilesResponse message. - * @function verify - * @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 - */ - 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.v1.AnnotateFileResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } - } - return null; - }; - - /** - * Creates a BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse - */ - BatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateFilesResponse) - return object; - 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 a BatchAnnotateFilesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1.BatchAnnotateFilesResponse} message BatchAnnotateFilesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchAnnotateFilesResponse.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.AnnotateFileResponse.toObject(message.responses[j], options); - } - return object; - }; - - /** - * Converts this BatchAnnotateFilesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateFilesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateFilesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.BatchAnnotateFilesResponse"; - }; - - return BatchAnnotateFilesResponse; - })(); - - v1.AsyncAnnotateFileRequest = (function() { - - /** - * Properties of an AsyncAnnotateFileRequest. - * @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 - */ - - /** - * Constructs a new AsyncAnnotateFileRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncAnnotateFileRequest. - * @implements IAsyncAnnotateFileRequest - * @constructor - * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest=} [properties] Properties to set - */ - 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]]; - } - - /** - * AsyncAnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.inputConfig = null; - - /** - * AsyncAnnotateFileRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; - - /** - * 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.AsyncAnnotateFileRequest - * @static - * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance - */ - AsyncAnnotateFileRequest.create = function create(properties) { - return new AsyncAnnotateFileRequest(properties); - }; - - /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @static - * @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 - */ - AsyncAnnotateFileRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1.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.v1.AsyncAnnotateFileRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @static - * @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 - */ - AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest - * @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) { - 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(); - 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: { - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncAnnotateFileRequest message. - * @function verify - * @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 - */ - AsyncAnnotateFileRequest.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.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 AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest - */ - AsyncAnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncAnnotateFileRequest) - return object; - 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.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 AsyncAnnotateFileRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @static - * @param {google.cloud.vision.v1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncAnnotateFileRequest.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.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 AsyncAnnotateFileRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncAnnotateFileRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncAnnotateFileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AsyncAnnotateFileRequest"; - }; - - return AsyncAnnotateFileRequest; - })(); - - v1.AsyncAnnotateFileResponse = (function() { - - /** - * Properties of an AsyncAnnotateFileResponse. - * @memberof google.cloud.vision.v1 - * @interface IAsyncAnnotateFileResponse - * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig - */ - - /** - * Constructs a new AsyncAnnotateFileResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncAnnotateFileResponse. - * @implements IAsyncAnnotateFileResponse - * @constructor - * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse=} [properties] Properties to set - */ - function AsyncAnnotateFileResponse(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]]; - } - - /** - * AsyncAnnotateFileResponse outputConfig. - * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @instance - */ - AsyncAnnotateFileResponse.prototype.outputConfig = null; - - /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @static - * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance - */ - AsyncAnnotateFileResponse.create = function create(properties) { - return new AsyncAnnotateFileResponse(properties); - }; - - /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @static - * @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 - */ - AsyncAnnotateFileResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, 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.v1.AsyncAnnotateFileResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @static - * @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 - */ - AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. - * @function decode - * @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.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncAnnotateFileResponse message. - * @function verify - * @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 - */ - AsyncAnnotateFileResponse.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; - } - return null; - }; - - /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse - */ - AsyncAnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncAnnotateFileResponse) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @static - * @param {google.cloud.vision.v1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncAnnotateFileResponse.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); - return object; - }; - - /** - * Converts this AsyncAnnotateFileResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncAnnotateFileResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncAnnotateFileResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AsyncAnnotateFileResponse"; - }; - - return AsyncAnnotateFileResponse; - })(); - - v1.AsyncBatchAnnotateImagesRequest = (function() { - - /** - * Properties of an AsyncBatchAnnotateImagesRequest. - * @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 - */ - - /** - * Constructs a new AsyncBatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncBatchAnnotateImagesRequest. - * @implements IAsyncBatchAnnotateImagesRequest - * @constructor - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set - */ - function AsyncBatchAnnotateImagesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * 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 - * @instance - */ - AsyncBatchAnnotateImagesRequest.prototype.outputConfig = null; - - /** - * AsyncBatchAnnotateImagesRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @instance - */ - AsyncBatchAnnotateImagesRequest.prototype.parent = ""; - - /** - * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest instance - */ - AsyncBatchAnnotateImagesRequest.create = function create(properties) { - return new AsyncBatchAnnotateImagesRequest(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @static - * @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 - */ - AsyncBatchAnnotateImagesRequest.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 && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); - return writer; - }; - - /** - * 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.AsyncBatchAnnotateImagesRequest - * @static - * @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 - */ - AsyncBatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest - * @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) { - 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(); - 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()); - break; - } - case 4: { - message.parent = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncBatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncBatchAnnotateImagesRequest message. - * @function verify - * @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 - */ - AsyncBatchAnnotateImagesRequest.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 (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"; - return null; - }; - - /** - * Creates an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest - */ - AsyncBatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest) - return object; - 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.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. - * @function toObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncBatchAnnotateImagesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.requests = []; - if (options.defaults) { - object.outputConfig = null; - 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); - } - 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. - * @function toJSON - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest"; - }; - - return AsyncBatchAnnotateImagesRequest; - })(); - - v1.AsyncBatchAnnotateImagesResponse = (function() { - - /** - * Properties of an AsyncBatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1 - * @interface IAsyncBatchAnnotateImagesResponse - * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesResponse outputConfig - */ - - /** - * Constructs a new AsyncBatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncBatchAnnotateImagesResponse. - * @implements IAsyncBatchAnnotateImagesResponse - * @constructor - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set - */ - function AsyncBatchAnnotateImagesResponse(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]]; - } - - /** - * AsyncBatchAnnotateImagesResponse outputConfig. - * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @instance - */ - AsyncBatchAnnotateImagesResponse.prototype.outputConfig = null; - - /** - * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse instance - */ - AsyncBatchAnnotateImagesResponse.create = function create(properties) { - return new AsyncBatchAnnotateImagesResponse(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @static - * @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 - */ - AsyncBatchAnnotateImagesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, 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. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @static - * @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 - */ - AsyncBatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer. - * @function decode - * @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.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncBatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncBatchAnnotateImagesResponse message. - * @function verify - * @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 - */ - AsyncBatchAnnotateImagesResponse.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; - } - return null; - }; - - /** - * Creates an AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse - */ - AsyncBatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AsyncBatchAnnotateImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncBatchAnnotateImagesResponse.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); - return object; - }; - - /** - * Converts this AsyncBatchAnnotateImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse"; - }; - - return AsyncBatchAnnotateImagesResponse; - })(); - - v1.AsyncBatchAnnotateFilesRequest = (function() { - - /** - * Properties of an AsyncBatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1 - * @interface IAsyncBatchAnnotateFilesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests - * @property {string|null} [parent] AsyncBatchAnnotateFilesRequest parent - */ - - /** - * Constructs a new AsyncBatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncBatchAnnotateFilesRequest. - * @implements IAsyncBatchAnnotateFilesRequest - * @constructor - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - */ - function AsyncBatchAnnotateFilesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * AsyncBatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest - * @instance - */ - AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; - - /** - * 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.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance - */ - AsyncBatchAnnotateFilesRequest.create = function create(properties) { - return new AsyncBatchAnnotateFilesRequest(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest - * @static - * @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 - */ - 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.v1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); - return writer; - }; - - /** - * 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.AsyncBatchAnnotateFilesRequest - * @static - * @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 - */ - AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest - * @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) { - 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(); - 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())); - break; - } - case 4: { - message.parent = reader.string(); - 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.v1.AsyncBatchAnnotateFilesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncBatchAnnotateFilesRequest message. - * @function verify - * @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 - */ - 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.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 an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest - */ - AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest) - 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]); - } - } - if (object.parent != null) - message.parent = String(object.parent); - return message; - }; - - /** - * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncBatchAnnotateFilesRequest.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); - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - return object; - }; - - /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateFilesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest"; - }; - - return AsyncBatchAnnotateFilesRequest; - })(); - - v1.AsyncBatchAnnotateFilesResponse = (function() { - - /** - * Properties of an AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1 - * @interface IAsyncBatchAnnotateFilesResponse - * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses - */ - - /** - * Constructs a new AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncBatchAnnotateFilesResponse. - * @implements IAsyncBatchAnnotateFilesResponse - * @constructor - * @param {google.cloud.vision.v1.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.v1.AsyncBatchAnnotateFilesResponse - * @instance - */ - AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance - */ - AsyncBatchAnnotateFilesResponse.create = function create(properties) { - return new AsyncBatchAnnotateFilesResponse(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse - * @static - * @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 - */ - 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.v1.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.v1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse - * @static - * @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 - */ - 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.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.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.v1.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.v1.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.v1.AsyncBatchAnnotateFilesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.v1.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.v1.AsyncBatchAnnotateFilesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse - */ - AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1.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.v1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); - } - return object; - }; - - /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateFilesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse"; - }; - - return AsyncBatchAnnotateFilesResponse; - })(); - - v1.InputConfig = (function() { - - /** - * Properties of an InputConfig. - * @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 - */ - - /** - * Constructs a new InputConfig. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig - * @constructor - * @param {google.cloud.vision.v1.IInputConfig=} [properties] Properties to set - */ - function InputConfig(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]]; - } - - /** - * InputConfig gcsSource. - * @member {google.cloud.vision.v1.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1.InputConfig - * @instance - */ - InputConfig.prototype.gcsSource = null; - - /** - * InputConfig content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1.InputConfig - * @instance - */ - InputConfig.prototype.content = $util.newBuffer([]); - - /** - * InputConfig mimeType. - * @member {string} mimeType - * @memberof google.cloud.vision.v1.InputConfig - * @instance - */ - InputConfig.prototype.mimeType = ""; - - /** - * Creates a new InputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.InputConfig - * @static - * @param {google.cloud.vision.v1.IInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1.InputConfig} InputConfig instance - */ - InputConfig.create = function create(properties) { - return new InputConfig(properties); - }; - - /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1.InputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.InputConfig - * @static - * @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 - */ - InputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.vision.v1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); - if (message.content != null && Object.hasOwnProperty.call(message, "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.v1.InputConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.InputConfig - * @static - * @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 - */ - 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.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.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.v1.InputConfig(); - 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(); - 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.v1.InputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1.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.v1.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.v1.InputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.InputConfig} InputConfig - */ - InputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.InputConfig) - 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); - } - 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 >= 0) - 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.v1.InputConfig - * @static - * @param {google.cloud.vision.v1.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.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 InputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.InputConfig - * @instance - * @returns {Object.} JSON object - */ - InputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1.InputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.InputConfig"; - }; - - return InputConfig; - })(); - - v1.OutputConfig = (function() { - - /** - * Properties of an OutputConfig. - * @memberof google.cloud.vision.v1 - * @interface IOutputConfig - * @property {google.cloud.vision.v1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination - * @property {number|null} [batchSize] OutputConfig batchSize - */ - - /** - * Constructs a new OutputConfig. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an OutputConfig. - * @implements IOutputConfig - * @constructor - * @param {google.cloud.vision.v1.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]]; - } - - /** - * 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 - * @instance - */ - OutputConfig.prototype.batchSize = 0; - - /** - * Creates a new OutputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.OutputConfig - * @static - * @param {google.cloud.vision.v1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig instance - */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); - }; - - /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1.OutputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.OutputConfig - * @static - * @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 - */ - OutputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) - $root.google.cloud.vision.v1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.batchSize != null && Object.hasOwnProperty.call(message, "batchSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); - return writer; - }; - - /** - * 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.OutputConfig - * @static - * @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 - */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OutputConfig message from the specified reader or buffer. - * @function decode - * @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.OutputConfig} OutputConfig - * @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) { - 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(); - 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(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.OutputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OutputConfig message. - * @function verify - * @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 - */ - OutputConfig.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 (error) - return "gcsDestination." + 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. - * @function fromObject - * @memberof google.cloud.vision.v1.OutputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig - */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.OutputConfig) - 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); - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1.OutputConfig - * @static - * @param {google.cloud.vision.v1.OutputConfig} message OutputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OutputConfig.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; - return object; - }; - - /** - * Converts this OutputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.OutputConfig - * @instance - * @returns {Object.} JSON object - */ - OutputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OutputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1.OutputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.OutputConfig"; - }; - - return OutputConfig; - })(); - - v1.GcsSource = (function() { - - /** - * Properties of a GcsSource. - * @memberof google.cloud.vision.v1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri - */ - - /** - * Constructs a new GcsSource. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource - * @constructor - * @param {google.cloud.vision.v1.IGcsSource=} [properties] Properties to set - */ - function GcsSource(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]]; - } - - /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.vision.v1.GcsSource - * @instance - */ - GcsSource.prototype.uri = ""; - - /** - * Creates a new GcsSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.GcsSource - * @static - * @param {google.cloud.vision.v1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1.GcsSource} GcsSource instance - */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); - }; - - /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1.GcsSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.GcsSource - * @static - * @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 - */ - GcsSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - return writer; - }; - - /** - * 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.GcsSource - * @static - * @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 - */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer. - * @function decode - * @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.GcsSource} GcsSource - * @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) { - 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(); - 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; - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.GcsSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GcsSource message. - * @function verify - * @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 - */ - GcsSource.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 GcsSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.GcsSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.GcsSource} GcsSource - */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.GcsSource) - return object; - 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 GcsSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.GcsSource - * @static - * @param {google.cloud.vision.v1.GcsSource} message GcsSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GcsSource.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; - }; - - /** - * Converts this GcsSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.GcsSource - * @instance - * @returns {Object.} JSON object - */ - GcsSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GcsSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1.GcsSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.GcsSource"; - }; - - return GcsSource; - })(); - - v1.GcsDestination = (function() { - - /** - * Properties of a GcsDestination. - * @memberof google.cloud.vision.v1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri - */ - - /** - * Constructs a new GcsDestination. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a GcsDestination. - * @implements IGcsDestination - * @constructor - * @param {google.cloud.vision.v1.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]]; - } - - /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.vision.v1.GcsDestination - * @instance - */ - GcsDestination.prototype.uri = ""; - - /** - * Creates a new GcsDestination instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.GcsDestination - * @static - * @param {google.cloud.vision.v1.IGcsDestination=} [properties] Properties to set - * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination instance - */ - GcsDestination.create = function create(properties) { - return new GcsDestination(properties); - }; - - /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1.GcsDestination.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.GcsDestination - * @static - * @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 - */ - GcsDestination.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - return writer; - }; - - /** - * 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.GcsDestination - * @static - * @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 - */ - GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GcsDestination message from the specified reader or buffer. - * @function decode - * @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.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.v1.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; - }; - - /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.GcsDestination - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - GcsDestination.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GcsDestination message. - * @function verify - * @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 - */ - 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 GcsDestination message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.GcsDestination - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination - */ - GcsDestination.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.GcsDestination) - return object; - 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 GcsDestination message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.GcsDestination - * @static - * @param {google.cloud.vision.v1.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; - }; - - /** - * Converts this GcsDestination to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.GcsDestination - * @instance - * @returns {Object.} JSON object - */ - GcsDestination.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GcsDestination - * @function getTypeUrl - * @memberof google.cloud.vision.v1.GcsDestination - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GcsDestination.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.GcsDestination"; - }; - - return GcsDestination; - })(); - - v1.OperationMetadata = (function() { - - /** - * Properties of an OperationMetadata. - * @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 - */ - - /** - * Constructs a new OperationMetadata. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata - * @constructor - * @param {google.cloud.vision.v1.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]]; - } - - /** - * OperationMetadata state. - * @member {google.cloud.vision.v1.OperationMetadata.State} state - * @memberof google.cloud.vision.v1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.state = 0; - - /** - * OperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.vision.v1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.createTime = null; - - /** - * OperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.vision.v1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.updateTime = null; - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.OperationMetadata - * @static - * @param {google.cloud.vision.v1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata instance - */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); - }; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1.OperationMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.OperationMetadata - * @static - * @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 - */ - OperationMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * 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.OperationMetadata - * @static - * @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 - */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer. - * @function decode - * @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.OperationMetadata} OperationMetadata - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.OperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationMetadata message. - * @function verify - * @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 - */ - OperationMetadata.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 (error) - return "updateTime." + error; - } - return null; - }; - - /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.OperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata - */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.OperationMetadata) - return object; - var message = new $root.google.cloud.vision.v1.OperationMetadata(); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - 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 an OperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.OperationMetadata - * @static - * @param {google.cloud.vision.v1.OperationMetadata} message OperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationMetadata.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.v1.OperationMetadata.State[message.state] === undefined ? message.state : $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 OperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.OperationMetadata - * @instance - * @returns {Object.} JSON object - */ - OperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationMetadata - * @function getTypeUrl - * @memberof google.cloud.vision.v1.OperationMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.OperationMetadata"; - }; - - /** - * State enum. - * @name google.cloud.vision.v1.OperationMetadata.State - * @enum {number} - * @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() { - - /** - * Properties of a ProductSearchParams. - * @memberof google.cloud.vision.v1 - * @interface IProductSearchParams - * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] ProductSearchParams boundingPoly - * @property {string|null} [productSet] ProductSearchParams productSet - * @property {Array.|null} [productCategories] ProductSearchParams productCategories - * @property {string|null} [filter] ProductSearchParams filter - */ - - /** - * Constructs a new ProductSearchParams. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ProductSearchParams. - * @implements IProductSearchParams - * @constructor - * @param {google.cloud.vision.v1.IProductSearchParams=} [properties] Properties to set - */ - function ProductSearchParams(properties) { - this.productCategories = []; - 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]]; - } - - /** - * ProductSearchParams boundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.boundingPoly = null; - - /** - * ProductSearchParams productSet. - * @member {string} productSet - * @memberof google.cloud.vision.v1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.productSet = ""; - - /** - * ProductSearchParams productCategories. - * @member {Array.} productCategories - * @memberof google.cloud.vision.v1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.productCategories = $util.emptyArray; - - /** - * ProductSearchParams filter. - * @member {string} filter - * @memberof google.cloud.vision.v1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.filter = ""; - - /** - * Creates a new ProductSearchParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1.IProductSearchParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ProductSearchParams} ProductSearchParams instance - */ - ProductSearchParams.create = function create(properties) { - return new ProductSearchParams(properties); - }; - - /** - * Encodes the specified ProductSearchParams message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1.IProductSearchParams} message ProductSearchParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.productSet); - if (message.productCategories != null && message.productCategories.length) - for (var i = 0; i < message.productCategories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.productCategories[i]); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.filter); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSearchParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchParams.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1.IProductSearchParams} message ProductSearchParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ProductSearchParams - * @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.ProductSearchParams} ProductSearchParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchParams.decode = function decode(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.ProductSearchParams(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 9: { - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 6: { - message.productSet = reader.string(); - break; - } - case 7: { - if (!(message.productCategories && message.productCategories.length)) - message.productCategories = []; - message.productCategories.push(reader.string()); - break; - } - case 8: { - message.filter = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ProductSearchParams} ProductSearchParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSearchParams message. - * @function verify - * @memberof google.cloud.vision.v1.ProductSearchParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSearchParams.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.productSet != null && message.hasOwnProperty("productSet")) - if (!$util.isString(message.productSet)) - return "productSet: string expected"; - if (message.productCategories != null && message.hasOwnProperty("productCategories")) { - if (!Array.isArray(message.productCategories)) - return "productCategories: array expected"; - for (var i = 0; i < message.productCategories.length; ++i) - if (!$util.isString(message.productCategories[i])) - return "productCategories: string[] expected"; - } - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - return null; - }; - - /** - * Creates a ProductSearchParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ProductSearchParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ProductSearchParams} ProductSearchParams - */ - ProductSearchParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ProductSearchParams) - return object; - var message = new $root.google.cloud.vision.v1.ProductSearchParams(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSearchParams.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.productSet != null) - message.productSet = String(object.productSet); - if (object.productCategories) { - if (!Array.isArray(object.productCategories)) - throw TypeError(".google.cloud.vision.v1.ProductSearchParams.productCategories: array expected"); - message.productCategories = []; - for (var i = 0; i < object.productCategories.length; ++i) - message.productCategories[i] = String(object.productCategories[i]); - } - if (object.filter != null) - message.filter = String(object.filter); - return message; - }; - - /** - * Creates a plain object from a ProductSearchParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1.ProductSearchParams} message ProductSearchParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSearchParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productCategories = []; - if (options.defaults) { - object.productSet = ""; - object.filter = ""; - object.boundingPoly = null; - } - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = message.productSet; - if (message.productCategories && message.productCategories.length) { - object.productCategories = []; - for (var j = 0; j < message.productCategories.length; ++j) - object.productCategories[j] = message.productCategories[j]; - } - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); - return object; - }; - - /** - * Converts this ProductSearchParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ProductSearchParams - * @instance - * @returns {Object.} JSON object - */ - ProductSearchParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSearchParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ProductSearchParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSearchParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ProductSearchParams"; - }; - - return ProductSearchParams; - })(); - - v1.ProductSearchResults = (function() { - - /** - * Properties of a ProductSearchResults. - * @memberof google.cloud.vision.v1 - * @interface IProductSearchResults - * @property {google.protobuf.ITimestamp|null} [indexTime] ProductSearchResults indexTime - * @property {Array.|null} [results] ProductSearchResults results - * @property {Array.|null} [productGroupedResults] ProductSearchResults productGroupedResults - */ - - /** - * Constructs a new ProductSearchResults. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ProductSearchResults. - * @implements IProductSearchResults - * @constructor - * @param {google.cloud.vision.v1.IProductSearchResults=} [properties] Properties to set - */ - function ProductSearchResults(properties) { - this.results = []; - this.productGroupedResults = []; - 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]]; - } - - /** - * ProductSearchResults indexTime. - * @member {google.protobuf.ITimestamp|null|undefined} indexTime - * @memberof google.cloud.vision.v1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.indexTime = null; - - /** - * ProductSearchResults results. - * @member {Array.} results - * @memberof google.cloud.vision.v1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.results = $util.emptyArray; - - /** - * ProductSearchResults productGroupedResults. - * @member {Array.} productGroupedResults - * @memberof google.cloud.vision.v1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.productGroupedResults = $util.emptyArray; - - /** - * Creates a new ProductSearchResults instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1.IProductSearchResults=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ProductSearchResults} ProductSearchResults instance - */ - ProductSearchResults.create = function create(properties) { - return new ProductSearchResults(properties); - }; - - /** - * Encodes the specified ProductSearchResults message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1.IProductSearchResults} message ProductSearchResults message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchResults.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.indexTime != null && Object.hasOwnProperty.call(message, "indexTime")) - $root.google.protobuf.Timestamp.encode(message.indexTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.vision.v1.ProductSearchResults.Result.encode(message.results[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.productGroupedResults != null && message.productGroupedResults.length) - for (var i = 0; i < message.productGroupedResults.length; ++i) - $root.google.cloud.vision.v1.ProductSearchResults.GroupedResult.encode(message.productGroupedResults[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSearchResults message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1.IProductSearchResults} message ProductSearchResults message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchResults.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ProductSearchResults - * @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.ProductSearchResults} ProductSearchResults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchResults.decode = function decode(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.ProductSearchResults(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - message.indexTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.vision.v1.ProductSearchResults.Result.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.productGroupedResults && message.productGroupedResults.length)) - message.productGroupedResults = []; - message.productGroupedResults.push($root.google.cloud.vision.v1.ProductSearchResults.GroupedResult.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchResults - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ProductSearchResults} ProductSearchResults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchResults.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSearchResults message. - * @function verify - * @memberof google.cloud.vision.v1.ProductSearchResults - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSearchResults.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.indexTime); - if (error) - return "indexTime." + error; - } - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.vision.v1.ProductSearchResults.Result.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.productGroupedResults != null && message.hasOwnProperty("productGroupedResults")) { - if (!Array.isArray(message.productGroupedResults)) - return "productGroupedResults: array expected"; - for (var i = 0; i < message.productGroupedResults.length; ++i) { - var error = $root.google.cloud.vision.v1.ProductSearchResults.GroupedResult.verify(message.productGroupedResults[i]); - if (error) - return "productGroupedResults." + error; - } - } - return null; - }; - - /** - * Creates a ProductSearchResults message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ProductSearchResults - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ProductSearchResults} ProductSearchResults - */ - ProductSearchResults.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ProductSearchResults) - return object; - var message = new $root.google.cloud.vision.v1.ProductSearchResults(); - if (object.indexTime != null) { - if (typeof object.indexTime !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.indexTime: object expected"); - message.indexTime = $root.google.protobuf.Timestamp.fromObject(object.indexTime); - } - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.results: object expected"); - message.results[i] = $root.google.cloud.vision.v1.ProductSearchResults.Result.fromObject(object.results[i]); - } - } - if (object.productGroupedResults) { - if (!Array.isArray(object.productGroupedResults)) - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.productGroupedResults: array expected"); - message.productGroupedResults = []; - for (var i = 0; i < object.productGroupedResults.length; ++i) { - if (typeof object.productGroupedResults[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.productGroupedResults: object expected"); - message.productGroupedResults[i] = $root.google.cloud.vision.v1.ProductSearchResults.GroupedResult.fromObject(object.productGroupedResults[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ProductSearchResults message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1.ProductSearchResults} message ProductSearchResults - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSearchResults.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.productGroupedResults = []; - } - if (options.defaults) - object.indexTime = null; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) - object.indexTime = $root.google.protobuf.Timestamp.toObject(message.indexTime, options); - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.vision.v1.ProductSearchResults.Result.toObject(message.results[j], options); - } - if (message.productGroupedResults && message.productGroupedResults.length) { - object.productGroupedResults = []; - for (var j = 0; j < message.productGroupedResults.length; ++j) - object.productGroupedResults[j] = $root.google.cloud.vision.v1.ProductSearchResults.GroupedResult.toObject(message.productGroupedResults[j], options); - } - return object; - }; - - /** - * Converts this ProductSearchResults to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ProductSearchResults - * @instance - * @returns {Object.} JSON object - */ - ProductSearchResults.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSearchResults - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ProductSearchResults - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSearchResults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ProductSearchResults"; - }; - - ProductSearchResults.Result = (function() { - - /** - * Properties of a Result. - * @memberof google.cloud.vision.v1.ProductSearchResults - * @interface IResult - * @property {google.cloud.vision.v1.IProduct|null} [product] Result product - * @property {number|null} [score] Result score - * @property {string|null} [image] Result image - */ - - /** - * Constructs a new Result. - * @memberof google.cloud.vision.v1.ProductSearchResults - * @classdesc Represents a Result. - * @implements IResult - * @constructor - * @param {google.cloud.vision.v1.ProductSearchResults.IResult=} [properties] Properties to set - */ - function Result(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]]; - } - - /** - * Result product. - * @member {google.cloud.vision.v1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @instance - */ - Result.prototype.product = null; - - /** - * Result score. - * @member {number} score - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @instance - */ - Result.prototype.score = 0; - - /** - * Result image. - * @member {string} image - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @instance - */ - Result.prototype.image = ""; - - /** - * Creates a new Result instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IResult=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ProductSearchResults.Result} Result instance - */ - Result.create = function create(properties) { - return new Result(properties); - }; - - /** - * Encodes the specified Result message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.Result.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IResult} message Result message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Result.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.image != null && Object.hasOwnProperty.call(message, "image")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.image); - return writer; - }; - - /** - * Encodes the specified Result message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.Result.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IResult} message Result message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Result.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Result message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @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.ProductSearchResults.Result} Result - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Result.decode = function decode(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.ProductSearchResults.Result(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.product = $root.google.cloud.vision.v1.Product.decode(reader, reader.uint32()); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.image = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Result message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ProductSearchResults.Result} Result - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Result.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Result message. - * @function verify - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Result.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.image != null && message.hasOwnProperty("image")) - if (!$util.isString(message.image)) - return "image: string expected"; - return null; - }; - - /** - * Creates a Result message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ProductSearchResults.Result} Result - */ - Result.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ProductSearchResults.Result) - return object; - var message = new $root.google.cloud.vision.v1.ProductSearchResults.Result(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.Result.product: object expected"); - message.product = $root.google.cloud.vision.v1.Product.fromObject(object.product); - } - if (object.score != null) - message.score = Number(object.score); - if (object.image != null) - message.image = String(object.image); - return message; - }; - - /** - * Creates a plain object from a Result message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.Result} message Result - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Result.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.score = 0; - object.image = ""; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1.Product.toObject(message.product, options); - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.image != null && message.hasOwnProperty("image")) - object.image = message.image; - return object; - }; - - /** - * Converts this Result to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @instance - * @returns {Object.} JSON object - */ - Result.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Result - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ProductSearchResults.Result - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Result.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ProductSearchResults.Result"; - }; - - return Result; - })(); - - ProductSearchResults.ObjectAnnotation = (function() { - - /** - * Properties of an ObjectAnnotation. - * @memberof google.cloud.vision.v1.ProductSearchResults - * @interface IObjectAnnotation - * @property {string|null} [mid] ObjectAnnotation mid - * @property {string|null} [languageCode] ObjectAnnotation languageCode - * @property {string|null} [name] ObjectAnnotation name - * @property {number|null} [score] ObjectAnnotation score - */ - - /** - * Constructs a new ObjectAnnotation. - * @memberof google.cloud.vision.v1.ProductSearchResults - * @classdesc Represents an ObjectAnnotation. - * @implements IObjectAnnotation - * @constructor - * @param {google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation=} [properties] Properties to set - */ - function ObjectAnnotation(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]]; - } - - /** - * ObjectAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.mid = ""; - - /** - * ObjectAnnotation languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.languageCode = ""; - - /** - * ObjectAnnotation name. - * @member {string} name - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.name = ""; - - /** - * ObjectAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.score = 0; - - /** - * Creates a new ObjectAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation instance - */ - ObjectAnnotation.create = function create(properties) { - return new ObjectAnnotation(properties); - }; - - /** - * Encodes the specified ObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation} message ObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ObjectAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - return writer; - }; - - /** - * Encodes the specified ObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IObjectAnnotation} message ObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ObjectAnnotation.decode = function decode(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.ProductSearchResults.ObjectAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ObjectAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ObjectAnnotation.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"; - return null; - }; - - /** - * Creates an ObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - */ - ObjectAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation) - return object; - var message = new $root.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation(); - 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); - return message; - }; - - /** - * Creates a plain object from an ObjectAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation} message ObjectAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ObjectAnnotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.mid = ""; - object.languageCode = ""; - object.name = ""; - object.score = 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; - return object; - }; - - /** - * Converts this ObjectAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @instance - * @returns {Object.} JSON object - */ - ObjectAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ObjectAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ObjectAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation"; - }; - - return ObjectAnnotation; - })(); - - ProductSearchResults.GroupedResult = (function() { - - /** - * Properties of a GroupedResult. - * @memberof google.cloud.vision.v1.ProductSearchResults - * @interface IGroupedResult - * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] GroupedResult boundingPoly - * @property {Array.|null} [results] GroupedResult results - * @property {Array.|null} [objectAnnotations] GroupedResult objectAnnotations - */ - - /** - * Constructs a new GroupedResult. - * @memberof google.cloud.vision.v1.ProductSearchResults - * @classdesc Represents a GroupedResult. - * @implements IGroupedResult - * @constructor - * @param {google.cloud.vision.v1.ProductSearchResults.IGroupedResult=} [properties] Properties to set - */ - function GroupedResult(properties) { - this.results = []; - this.objectAnnotations = []; - 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]]; - } - - /** - * GroupedResult boundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.boundingPoly = null; - - /** - * GroupedResult results. - * @member {Array.} results - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.results = $util.emptyArray; - - /** - * GroupedResult objectAnnotations. - * @member {Array.} objectAnnotations - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.objectAnnotations = $util.emptyArray; - - /** - * Creates a new GroupedResult instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IGroupedResult=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ProductSearchResults.GroupedResult} GroupedResult instance - */ - GroupedResult.create = function create(properties) { - return new GroupedResult(properties); - }; - - /** - * Encodes the specified GroupedResult message. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IGroupedResult} message GroupedResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GroupedResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.vision.v1.ProductSearchResults.Result.encode(message.results[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.objectAnnotations != null && message.objectAnnotations.length) - for (var i = 0; i < message.objectAnnotations.length; ++i) - $root.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.encode(message.objectAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GroupedResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.IGroupedResult} message GroupedResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GroupedResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GroupedResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @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.ProductSearchResults.GroupedResult} GroupedResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GroupedResult.decode = function decode(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.ProductSearchResults.GroupedResult(); - 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: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.vision.v1.ProductSearchResults.Result.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.objectAnnotations && message.objectAnnotations.length)) - message.objectAnnotations = []; - message.objectAnnotations.push($root.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GroupedResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ProductSearchResults.GroupedResult} GroupedResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GroupedResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GroupedResult message. - * @function verify - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GroupedResult.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.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.vision.v1.ProductSearchResults.Result.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.objectAnnotations != null && message.hasOwnProperty("objectAnnotations")) { - if (!Array.isArray(message.objectAnnotations)) - return "objectAnnotations: array expected"; - for (var i = 0; i < message.objectAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.verify(message.objectAnnotations[i]); - if (error) - return "objectAnnotations." + error; - } - } - return null; - }; - - /** - * Creates a GroupedResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ProductSearchResults.GroupedResult} GroupedResult - */ - GroupedResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ProductSearchResults.GroupedResult) - return object; - var message = new $root.google.cloud.vision.v1.ProductSearchResults.GroupedResult(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.GroupedResult.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.GroupedResult.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.GroupedResult.results: object expected"); - message.results[i] = $root.google.cloud.vision.v1.ProductSearchResults.Result.fromObject(object.results[i]); - } - } - if (object.objectAnnotations) { - if (!Array.isArray(object.objectAnnotations)) - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.GroupedResult.objectAnnotations: array expected"); - message.objectAnnotations = []; - for (var i = 0; i < object.objectAnnotations.length; ++i) { - if (typeof object.objectAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSearchResults.GroupedResult.objectAnnotations: object expected"); - message.objectAnnotations[i] = $root.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.fromObject(object.objectAnnotations[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GroupedResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1.ProductSearchResults.GroupedResult} message GroupedResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GroupedResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.objectAnnotations = []; - } - if (options.defaults) - object.boundingPoly = null; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.vision.v1.ProductSearchResults.Result.toObject(message.results[j], options); - } - if (message.objectAnnotations && message.objectAnnotations.length) { - object.objectAnnotations = []; - for (var j = 0; j < message.objectAnnotations.length; ++j) - object.objectAnnotations[j] = $root.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation.toObject(message.objectAnnotations[j], options); - } - return object; - }; - - /** - * Converts this GroupedResult to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @instance - * @returns {Object.} JSON object - */ - GroupedResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GroupedResult - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ProductSearchResults.GroupedResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GroupedResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ProductSearchResults.GroupedResult"; - }; - - return GroupedResult; - })(); - - return ProductSearchResults; - })(); - - v1.ProductSearch = (function() { - - /** - * Constructs a new ProductSearch service. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ProductSearch - * @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 ProductSearch(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ProductSearch.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductSearch; - - /** - * Creates new ProductSearch service using the specified rpc implementation. - * @function create - * @memberof google.cloud.vision.v1.ProductSearch - * @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 {ProductSearch} RPC service. Useful where requests and/or responses are streamed. - */ - ProductSearch.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|createProductSet}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef CreateProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ProductSet} [response] ProductSet - */ - - /** - * Calls CreateProductSet. - * @function createProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.ICreateProductSetRequest} request CreateProductSetRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.CreateProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createProductSet = function createProductSet(request, callback) { - return this.rpcCall(createProductSet, $root.google.cloud.vision.v1.CreateProductSetRequest, $root.google.cloud.vision.v1.ProductSet, request, callback); - }, "name", { value: "CreateProductSet" }); - - /** - * Calls CreateProductSet. - * @function createProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.ICreateProductSetRequest} request CreateProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|listProductSets}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef ListProductSetsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ListProductSetsResponse} [response] ListProductSetsResponse - */ - - /** - * Calls ListProductSets. - * @function listProductSets - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IListProductSetsRequest} request ListProductSetsRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.ListProductSetsCallback} callback Node-style callback called with the error, if any, and ListProductSetsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProductSets = function listProductSets(request, callback) { - return this.rpcCall(listProductSets, $root.google.cloud.vision.v1.ListProductSetsRequest, $root.google.cloud.vision.v1.ListProductSetsResponse, request, callback); - }, "name", { value: "ListProductSets" }); - - /** - * Calls ListProductSets. - * @function listProductSets - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IListProductSetsRequest} request ListProductSetsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|getProductSet}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef GetProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ProductSet} [response] ProductSet - */ - - /** - * Calls GetProductSet. - * @function getProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IGetProductSetRequest} request GetProductSetRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.GetProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getProductSet = function getProductSet(request, callback) { - return this.rpcCall(getProductSet, $root.google.cloud.vision.v1.GetProductSetRequest, $root.google.cloud.vision.v1.ProductSet, request, callback); - }, "name", { value: "GetProductSet" }); - - /** - * Calls GetProductSet. - * @function getProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IGetProductSetRequest} request GetProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|updateProductSet}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef UpdateProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ProductSet} [response] ProductSet - */ - - /** - * Calls UpdateProductSet. - * @function updateProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IUpdateProductSetRequest} request UpdateProductSetRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.UpdateProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.updateProductSet = function updateProductSet(request, callback) { - return this.rpcCall(updateProductSet, $root.google.cloud.vision.v1.UpdateProductSetRequest, $root.google.cloud.vision.v1.ProductSet, request, callback); - }, "name", { value: "UpdateProductSet" }); - - /** - * Calls UpdateProductSet. - * @function updateProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IUpdateProductSetRequest} request UpdateProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|deleteProductSet}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef DeleteProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProductSet. - * @function deleteProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IDeleteProductSetRequest} request DeleteProductSetRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.DeleteProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteProductSet = function deleteProductSet(request, callback) { - return this.rpcCall(deleteProductSet, $root.google.cloud.vision.v1.DeleteProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProductSet" }); - - /** - * Calls DeleteProductSet. - * @function deleteProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IDeleteProductSetRequest} request DeleteProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|createProduct}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.Product} [response] Product - */ - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.vision.v1.CreateProductRequest, $root.google.cloud.vision.v1.Product, request, callback); - }, "name", { value: "CreateProduct" }); - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|listProducts}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef ListProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ListProductsResponse} [response] ListProductsResponse - */ - - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IListProductsRequest} request ListProductsRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProducts = function listProducts(request, callback) { - return this.rpcCall(listProducts, $root.google.cloud.vision.v1.ListProductsRequest, $root.google.cloud.vision.v1.ListProductsResponse, request, callback); - }, "name", { value: "ListProducts" }); - - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IListProductsRequest} request ListProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|getProduct}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.Product} [response] Product - */ - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.vision.v1.GetProductRequest, $root.google.cloud.vision.v1.Product, request, callback); - }, "name", { value: "GetProduct" }); - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|updateProduct}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.Product} [response] Product - */ - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.vision.v1.UpdateProductRequest, $root.google.cloud.vision.v1.Product, request, callback); - }, "name", { value: "UpdateProduct" }); - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|deleteProduct}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.vision.v1.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|createReferenceImage}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef CreateReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ReferenceImage} [response] ReferenceImage - */ - - /** - * Calls CreateReferenceImage. - * @function createReferenceImage - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.ICreateReferenceImageRequest} request CreateReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.CreateReferenceImageCallback} callback Node-style callback called with the error, if any, and ReferenceImage - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createReferenceImage = function createReferenceImage(request, callback) { - return this.rpcCall(createReferenceImage, $root.google.cloud.vision.v1.CreateReferenceImageRequest, $root.google.cloud.vision.v1.ReferenceImage, request, callback); - }, "name", { value: "CreateReferenceImage" }); - - /** - * Calls CreateReferenceImage. - * @function createReferenceImage - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.ICreateReferenceImageRequest} request CreateReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|deleteReferenceImage}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef DeleteReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteReferenceImage. - * @function deleteReferenceImage - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IDeleteReferenceImageRequest} request DeleteReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.DeleteReferenceImageCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteReferenceImage = function deleteReferenceImage(request, callback) { - return this.rpcCall(deleteReferenceImage, $root.google.cloud.vision.v1.DeleteReferenceImageRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteReferenceImage" }); - - /** - * Calls DeleteReferenceImage. - * @function deleteReferenceImage - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IDeleteReferenceImageRequest} request DeleteReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|listReferenceImages}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef ListReferenceImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ListReferenceImagesResponse} [response] ListReferenceImagesResponse - */ - - /** - * Calls ListReferenceImages. - * @function listReferenceImages - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IListReferenceImagesRequest} request ListReferenceImagesRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.ListReferenceImagesCallback} callback Node-style callback called with the error, if any, and ListReferenceImagesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listReferenceImages = function listReferenceImages(request, callback) { - return this.rpcCall(listReferenceImages, $root.google.cloud.vision.v1.ListReferenceImagesRequest, $root.google.cloud.vision.v1.ListReferenceImagesResponse, request, callback); - }, "name", { value: "ListReferenceImages" }); - - /** - * Calls ListReferenceImages. - * @function listReferenceImages - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IListReferenceImagesRequest} request ListReferenceImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|getReferenceImage}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef GetReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ReferenceImage} [response] ReferenceImage - */ - - /** - * Calls GetReferenceImage. - * @function getReferenceImage - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IGetReferenceImageRequest} request GetReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.GetReferenceImageCallback} callback Node-style callback called with the error, if any, and ReferenceImage - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getReferenceImage = function getReferenceImage(request, callback) { - return this.rpcCall(getReferenceImage, $root.google.cloud.vision.v1.GetReferenceImageRequest, $root.google.cloud.vision.v1.ReferenceImage, request, callback); - }, "name", { value: "GetReferenceImage" }); - - /** - * Calls GetReferenceImage. - * @function getReferenceImage - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IGetReferenceImageRequest} request GetReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|addProductToProductSet}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef AddProductToProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls AddProductToProductSet. - * @function addProductToProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IAddProductToProductSetRequest} request AddProductToProductSetRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.AddProductToProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.addProductToProductSet = function addProductToProductSet(request, callback) { - return this.rpcCall(addProductToProductSet, $root.google.cloud.vision.v1.AddProductToProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "AddProductToProductSet" }); - - /** - * Calls AddProductToProductSet. - * @function addProductToProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IAddProductToProductSetRequest} request AddProductToProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|removeProductFromProductSet}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef RemoveProductFromProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls RemoveProductFromProductSet. - * @function removeProductFromProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IRemoveProductFromProductSetRequest} request RemoveProductFromProductSetRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.RemoveProductFromProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.removeProductFromProductSet = function removeProductFromProductSet(request, callback) { - return this.rpcCall(removeProductFromProductSet, $root.google.cloud.vision.v1.RemoveProductFromProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "RemoveProductFromProductSet" }); - - /** - * Calls RemoveProductFromProductSet. - * @function removeProductFromProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IRemoveProductFromProductSetRequest} request RemoveProductFromProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|listProductsInProductSet}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef ListProductsInProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.ListProductsInProductSetResponse} [response] ListProductsInProductSetResponse - */ - - /** - * Calls ListProductsInProductSet. - * @function listProductsInProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IListProductsInProductSetRequest} request ListProductsInProductSetRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.ListProductsInProductSetCallback} callback Node-style callback called with the error, if any, and ListProductsInProductSetResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProductsInProductSet = function listProductsInProductSet(request, callback) { - return this.rpcCall(listProductsInProductSet, $root.google.cloud.vision.v1.ListProductsInProductSetRequest, $root.google.cloud.vision.v1.ListProductsInProductSetResponse, request, callback); - }, "name", { value: "ListProductsInProductSet" }); - - /** - * Calls ListProductsInProductSet. - * @function listProductsInProductSet - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IListProductsInProductSetRequest} request ListProductsInProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|importProductSets}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef ImportProductSetsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportProductSets. - * @function importProductSets - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IImportProductSetsRequest} request ImportProductSetsRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.ImportProductSetsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.importProductSets = function importProductSets(request, callback) { - return this.rpcCall(importProductSets, $root.google.cloud.vision.v1.ImportProductSetsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProductSets" }); - - /** - * Calls ImportProductSets. - * @function importProductSets - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IImportProductSetsRequest} request ImportProductSetsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ProductSearch|purgeProducts}. - * @memberof google.cloud.vision.v1.ProductSearch - * @typedef PurgeProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls PurgeProducts. - * @function purgeProducts - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IPurgeProductsRequest} request PurgeProductsRequest message or plain object - * @param {google.cloud.vision.v1.ProductSearch.PurgeProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.purgeProducts = function purgeProducts(request, callback) { - return this.rpcCall(purgeProducts, $root.google.cloud.vision.v1.PurgeProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "PurgeProducts" }); - - /** - * Calls PurgeProducts. - * @function purgeProducts - * @memberof google.cloud.vision.v1.ProductSearch - * @instance - * @param {google.cloud.vision.v1.IPurgeProductsRequest} request PurgeProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ProductSearch; - })(); - - v1.Product = (function() { - - /** - * Properties of a Product. - * @memberof google.cloud.vision.v1 - * @interface IProduct - * @property {string|null} [name] Product name - * @property {string|null} [displayName] Product displayName - * @property {string|null} [description] Product description - * @property {string|null} [productCategory] Product productCategory - * @property {Array.|null} [productLabels] Product productLabels - */ - - /** - * Constructs a new Product. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a Product. - * @implements IProduct - * @constructor - * @param {google.cloud.vision.v1.IProduct=} [properties] Properties to set - */ - function Product(properties) { - this.productLabels = []; - 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]]; - } - - /** - * Product name. - * @member {string} name - * @memberof google.cloud.vision.v1.Product - * @instance - */ - Product.prototype.name = ""; - - /** - * Product displayName. - * @member {string} displayName - * @memberof google.cloud.vision.v1.Product - * @instance - */ - Product.prototype.displayName = ""; - - /** - * Product description. - * @member {string} description - * @memberof google.cloud.vision.v1.Product - * @instance - */ - Product.prototype.description = ""; - - /** - * Product productCategory. - * @member {string} productCategory - * @memberof google.cloud.vision.v1.Product - * @instance - */ - Product.prototype.productCategory = ""; - - /** - * Product productLabels. - * @member {Array.} productLabels - * @memberof google.cloud.vision.v1.Product - * @instance - */ - Product.prototype.productLabels = $util.emptyArray; - - /** - * Creates a new Product instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Product - * @static - * @param {google.cloud.vision.v1.IProduct=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Product} Product instance - */ - Product.create = function create(properties) { - return new Product(properties); - }; - - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.vision.v1.Product.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Product - * @static - * @param {google.cloud.vision.v1.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Product.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.productCategory != null && Object.hasOwnProperty.call(message, "productCategory")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.productCategory); - if (message.productLabels != null && message.productLabels.length) - for (var i = 0; i < message.productLabels.length; ++i) - $root.google.cloud.vision.v1.Product.KeyValue.encode(message.productLabels[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Product.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.Product - * @static - * @param {google.cloud.vision.v1.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Product.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Product message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.Product - * @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.Product} Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Product.decode = function decode(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.Product(); - 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; - } - case 4: { - message.productCategory = reader.string(); - break; - } - case 5: { - if (!(message.productLabels && message.productLabels.length)) - message.productLabels = []; - message.productLabels.push($root.google.cloud.vision.v1.Product.KeyValue.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.Product - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Product} Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Product.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Product message. - * @function verify - * @memberof google.cloud.vision.v1.Product - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Product.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.productCategory != null && message.hasOwnProperty("productCategory")) - if (!$util.isString(message.productCategory)) - return "productCategory: string expected"; - if (message.productLabels != null && message.hasOwnProperty("productLabels")) { - if (!Array.isArray(message.productLabels)) - return "productLabels: array expected"; - for (var i = 0; i < message.productLabels.length; ++i) { - var error = $root.google.cloud.vision.v1.Product.KeyValue.verify(message.productLabels[i]); - if (error) - return "productLabels." + error; - } - } - return null; - }; - - /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.Product - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Product} Product - */ - Product.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Product) - return object; - var message = new $root.google.cloud.vision.v1.Product(); - 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); - if (object.productCategory != null) - message.productCategory = String(object.productCategory); - if (object.productLabels) { - if (!Array.isArray(object.productLabels)) - throw TypeError(".google.cloud.vision.v1.Product.productLabels: array expected"); - message.productLabels = []; - for (var i = 0; i < object.productLabels.length; ++i) { - if (typeof object.productLabels[i] !== "object") - throw TypeError(".google.cloud.vision.v1.Product.productLabels: object expected"); - message.productLabels[i] = $root.google.cloud.vision.v1.Product.KeyValue.fromObject(object.productLabels[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.Product - * @static - * @param {google.cloud.vision.v1.Product} message Product - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Product.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productLabels = []; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.description = ""; - object.productCategory = ""; - } - 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; - if (message.productCategory != null && message.hasOwnProperty("productCategory")) - object.productCategory = message.productCategory; - if (message.productLabels && message.productLabels.length) { - object.productLabels = []; - for (var j = 0; j < message.productLabels.length; ++j) - object.productLabels[j] = $root.google.cloud.vision.v1.Product.KeyValue.toObject(message.productLabels[j], options); - } - return object; - }; - - /** - * Converts this Product to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.Product - * @instance - * @returns {Object.} JSON object - */ - Product.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Product - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Product - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Product.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Product"; - }; - - Product.KeyValue = (function() { - - /** - * Properties of a KeyValue. - * @memberof google.cloud.vision.v1.Product - * @interface IKeyValue - * @property {string|null} [key] KeyValue key - * @property {string|null} [value] KeyValue value - */ - - /** - * Constructs a new KeyValue. - * @memberof google.cloud.vision.v1.Product - * @classdesc Represents a KeyValue. - * @implements IKeyValue - * @constructor - * @param {google.cloud.vision.v1.Product.IKeyValue=} [properties] Properties to set - */ - function KeyValue(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]]; - } - - /** - * KeyValue key. - * @member {string} key - * @memberof google.cloud.vision.v1.Product.KeyValue - * @instance - */ - KeyValue.prototype.key = ""; - - /** - * KeyValue value. - * @member {string} value - * @memberof google.cloud.vision.v1.Product.KeyValue - * @instance - */ - KeyValue.prototype.value = ""; - - /** - * Creates a new KeyValue instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1.Product.IKeyValue=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Product.KeyValue} KeyValue instance - */ - KeyValue.create = function create(properties) { - return new KeyValue(properties); - }; - - /** - * Encodes the specified KeyValue message. Does not implicitly {@link google.cloud.vision.v1.Product.KeyValue.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1.Product.IKeyValue} message KeyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Product.KeyValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1.Product.IKeyValue} message KeyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a KeyValue message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.Product.KeyValue - * @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.Product.KeyValue} KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValue.decode = function decode(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.Product.KeyValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.key = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a KeyValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.Product.KeyValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Product.KeyValue} KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a KeyValue message. - * @function verify - * @memberof google.cloud.vision.v1.Product.KeyValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - KeyValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a KeyValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.Product.KeyValue - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Product.KeyValue} KeyValue - */ - KeyValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Product.KeyValue) - return object; - var message = new $root.google.cloud.vision.v1.Product.KeyValue(); - if (object.key != null) - message.key = String(object.key); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a KeyValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1.Product.KeyValue} message KeyValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - KeyValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.key = ""; - object.value = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this KeyValue to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.Product.KeyValue - * @instance - * @returns {Object.} JSON object - */ - KeyValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for KeyValue - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Product.KeyValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - KeyValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Product.KeyValue"; - }; - - return KeyValue; - })(); - - return Product; - })(); - - v1.ProductSet = (function() { - - /** - * Properties of a ProductSet. - * @memberof google.cloud.vision.v1 - * @interface IProductSet - * @property {string|null} [name] ProductSet name - * @property {string|null} [displayName] ProductSet displayName - * @property {google.protobuf.ITimestamp|null} [indexTime] ProductSet indexTime - * @property {google.rpc.IStatus|null} [indexError] ProductSet indexError - */ - - /** - * Constructs a new ProductSet. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ProductSet. - * @implements IProductSet - * @constructor - * @param {google.cloud.vision.v1.IProductSet=} [properties] Properties to set - */ - function ProductSet(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]]; - } - - /** - * ProductSet name. - * @member {string} name - * @memberof google.cloud.vision.v1.ProductSet - * @instance - */ - ProductSet.prototype.name = ""; - - /** - * ProductSet displayName. - * @member {string} displayName - * @memberof google.cloud.vision.v1.ProductSet - * @instance - */ - ProductSet.prototype.displayName = ""; - - /** - * ProductSet indexTime. - * @member {google.protobuf.ITimestamp|null|undefined} indexTime - * @memberof google.cloud.vision.v1.ProductSet - * @instance - */ - ProductSet.prototype.indexTime = null; - - /** - * ProductSet indexError. - * @member {google.rpc.IStatus|null|undefined} indexError - * @memberof google.cloud.vision.v1.ProductSet - * @instance - */ - ProductSet.prototype.indexError = null; - - /** - * Creates a new ProductSet instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ProductSet - * @static - * @param {google.cloud.vision.v1.IProductSet=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ProductSet} ProductSet instance - */ - ProductSet.create = function create(properties) { - return new ProductSet(properties); - }; - - /** - * Encodes the specified ProductSet message. Does not implicitly {@link google.cloud.vision.v1.ProductSet.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ProductSet - * @static - * @param {google.cloud.vision.v1.IProductSet} message ProductSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.indexTime != null && Object.hasOwnProperty.call(message, "indexTime")) - $root.google.protobuf.Timestamp.encode(message.indexTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.indexError != null && Object.hasOwnProperty.call(message, "indexError")) - $root.google.rpc.Status.encode(message.indexError, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSet message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ProductSet - * @static - * @param {google.cloud.vision.v1.IProductSet} message ProductSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ProductSet - * @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.ProductSet} ProductSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSet.decode = function decode(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.ProductSet(); - 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.indexTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 4: { - message.indexError = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ProductSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ProductSet} ProductSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSet message. - * @function verify - * @memberof google.cloud.vision.v1.ProductSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSet.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.indexTime != null && message.hasOwnProperty("indexTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.indexTime); - if (error) - return "indexTime." + error; - } - if (message.indexError != null && message.hasOwnProperty("indexError")) { - var error = $root.google.rpc.Status.verify(message.indexError); - if (error) - return "indexError." + error; - } - return null; - }; - - /** - * Creates a ProductSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ProductSet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ProductSet} ProductSet - */ - ProductSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ProductSet) - return object; - var message = new $root.google.cloud.vision.v1.ProductSet(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.indexTime != null) { - if (typeof object.indexTime !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSet.indexTime: object expected"); - message.indexTime = $root.google.protobuf.Timestamp.fromObject(object.indexTime); - } - if (object.indexError != null) { - if (typeof object.indexError !== "object") - throw TypeError(".google.cloud.vision.v1.ProductSet.indexError: object expected"); - message.indexError = $root.google.rpc.Status.fromObject(object.indexError); - } - return message; - }; - - /** - * Creates a plain object from a ProductSet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ProductSet - * @static - * @param {google.cloud.vision.v1.ProductSet} message ProductSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.indexTime = null; - object.indexError = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) - object.indexTime = $root.google.protobuf.Timestamp.toObject(message.indexTime, options); - if (message.indexError != null && message.hasOwnProperty("indexError")) - object.indexError = $root.google.rpc.Status.toObject(message.indexError, options); - return object; - }; - - /** - * Converts this ProductSet to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ProductSet - * @instance - * @returns {Object.} JSON object - */ - ProductSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSet - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ProductSet - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ProductSet"; - }; - - return ProductSet; - })(); - - v1.ReferenceImage = (function() { - - /** - * Properties of a ReferenceImage. - * @memberof google.cloud.vision.v1 - * @interface IReferenceImage - * @property {string|null} [name] ReferenceImage name - * @property {string|null} [uri] ReferenceImage uri - * @property {Array.|null} [boundingPolys] ReferenceImage boundingPolys - */ - - /** - * Constructs a new ReferenceImage. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ReferenceImage. - * @implements IReferenceImage - * @constructor - * @param {google.cloud.vision.v1.IReferenceImage=} [properties] Properties to set - */ - function ReferenceImage(properties) { - this.boundingPolys = []; - 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]]; - } - - /** - * ReferenceImage name. - * @member {string} name - * @memberof google.cloud.vision.v1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.name = ""; - - /** - * ReferenceImage uri. - * @member {string} uri - * @memberof google.cloud.vision.v1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.uri = ""; - - /** - * ReferenceImage boundingPolys. - * @member {Array.} boundingPolys - * @memberof google.cloud.vision.v1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.boundingPolys = $util.emptyArray; - - /** - * Creates a new ReferenceImage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ReferenceImage - * @static - * @param {google.cloud.vision.v1.IReferenceImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ReferenceImage} ReferenceImage instance - */ - ReferenceImage.create = function create(properties) { - return new ReferenceImage(properties); - }; - - /** - * Encodes the specified ReferenceImage message. Does not implicitly {@link google.cloud.vision.v1.ReferenceImage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ReferenceImage - * @static - * @param {google.cloud.vision.v1.IReferenceImage} message ReferenceImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReferenceImage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); - if (message.boundingPolys != null && message.boundingPolys.length) - for (var i = 0; i < message.boundingPolys.length; ++i) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPolys[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ReferenceImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ReferenceImage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ReferenceImage - * @static - * @param {google.cloud.vision.v1.IReferenceImage} message ReferenceImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReferenceImage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ReferenceImage - * @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.ReferenceImage} ReferenceImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReferenceImage.decode = function decode(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.ReferenceImage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.uri = reader.string(); - break; - } - case 3: { - if (!(message.boundingPolys && message.boundingPolys.length)) - message.boundingPolys = []; - message.boundingPolys.push($root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ReferenceImage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ReferenceImage} ReferenceImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReferenceImage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReferenceImage message. - * @function verify - * @memberof google.cloud.vision.v1.ReferenceImage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReferenceImage.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.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.boundingPolys != null && message.hasOwnProperty("boundingPolys")) { - if (!Array.isArray(message.boundingPolys)) - return "boundingPolys: array expected"; - for (var i = 0; i < message.boundingPolys.length; ++i) { - var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.boundingPolys[i]); - if (error) - return "boundingPolys." + error; - } - } - return null; - }; - - /** - * Creates a ReferenceImage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ReferenceImage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ReferenceImage} ReferenceImage - */ - ReferenceImage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ReferenceImage) - return object; - var message = new $root.google.cloud.vision.v1.ReferenceImage(); - if (object.name != null) - message.name = String(object.name); - if (object.uri != null) - message.uri = String(object.uri); - if (object.boundingPolys) { - if (!Array.isArray(object.boundingPolys)) - throw TypeError(".google.cloud.vision.v1.ReferenceImage.boundingPolys: array expected"); - message.boundingPolys = []; - for (var i = 0; i < object.boundingPolys.length; ++i) { - if (typeof object.boundingPolys[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ReferenceImage.boundingPolys: object expected"); - message.boundingPolys[i] = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPolys[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ReferenceImage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ReferenceImage - * @static - * @param {google.cloud.vision.v1.ReferenceImage} message ReferenceImage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReferenceImage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.boundingPolys = []; - if (options.defaults) { - object.name = ""; - object.uri = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.boundingPolys && message.boundingPolys.length) { - object.boundingPolys = []; - for (var j = 0; j < message.boundingPolys.length; ++j) - object.boundingPolys[j] = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPolys[j], options); - } - return object; - }; - - /** - * Converts this ReferenceImage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ReferenceImage - * @instance - * @returns {Object.} JSON object - */ - ReferenceImage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReferenceImage - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ReferenceImage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReferenceImage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ReferenceImage"; - }; - - return ReferenceImage; - })(); - - v1.CreateProductRequest = (function() { - - /** - * Properties of a CreateProductRequest. - * @memberof google.cloud.vision.v1 - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.vision.v1.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId - */ - - /** - * Constructs a new CreateProductRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest - * @constructor - * @param {google.cloud.vision.v1.ICreateProductRequest=} [properties] Properties to set - */ - function CreateProductRequest(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]]; - } - - /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.parent = ""; - - /** - * CreateProductRequest product. - * @member {google.cloud.vision.v1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.product = null; - - /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.vision.v1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.productId = ""; - - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CreateProductRequest} CreateProductRequest instance - */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); - }; - - /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.vision.v1.CreateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); - return writer; - }; - - /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CreateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.CreateProductRequest - * @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.CreateProductRequest} CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductRequest.decode = function decode(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.CreateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.product = $root.google.cloud.vision.v1.Product.decode(reader, reader.uint32()); - break; - } - case 3: { - message.productId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.CreateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.CreateProductRequest} CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1.CreateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; - return null; - }; - - /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.CreateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CreateProductRequest} CreateProductRequest - */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CreateProductRequest) - return object; - var message = new $root.google.cloud.vision.v1.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.vision.v1.Product.fromObject(object.product); - } - if (object.productId != null) - message.productId = String(object.productId); - return message; - }; - - /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1.CreateProductRequest} message CreateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; - return object; - }; - - /** - * Converts this CreateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.CreateProductRequest - * @instance - * @returns {Object.} JSON object - */ - CreateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.CreateProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.CreateProductRequest"; - }; - - return CreateProductRequest; - })(); - - v1.ListProductsRequest = (function() { - - /** - * Properties of a ListProductsRequest. - * @memberof google.cloud.vision.v1 - * @interface IListProductsRequest - * @property {string|null} [parent] ListProductsRequest parent - * @property {number|null} [pageSize] ListProductsRequest pageSize - * @property {string|null} [pageToken] ListProductsRequest pageToken - */ - - /** - * Constructs a new ListProductsRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ListProductsRequest. - * @implements IListProductsRequest - * @constructor - * @param {google.cloud.vision.v1.IListProductsRequest=} [properties] Properties to set - */ - function ListProductsRequest(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]]; - } - - /** - * ListProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.parent = ""; - - /** - * ListProductsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageSize = 0; - - /** - * ListProductsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1.IListProductsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ListProductsRequest} ListProductsRequest instance - */ - ListProductsRequest.create = function create(properties) { - return new ListProductsRequest(properties); - }; - - /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.vision.v1.ListProductsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1.IListProductsRequest} message ListProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1.IListProductsRequest} message ListProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ListProductsRequest - * @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.ListProductsRequest} ListProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsRequest.decode = function decode(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.ListProductsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ListProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ListProductsRequest} ListProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsRequest message. - * @function verify - * @memberof google.cloud.vision.v1.ListProductsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ListProductsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ListProductsRequest} ListProductsRequest - */ - ListProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ListProductsRequest) - return object; - var message = new $root.google.cloud.vision.v1.ListProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1.ListProductsRequest} message ListProductsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ListProductsRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ListProductsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ListProductsRequest"; - }; - - return ListProductsRequest; - })(); - - v1.ListProductsResponse = (function() { - - /** - * Properties of a ListProductsResponse. - * @memberof google.cloud.vision.v1 - * @interface IListProductsResponse - * @property {Array.|null} [products] ListProductsResponse products - * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken - */ - - /** - * Constructs a new ListProductsResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ListProductsResponse. - * @implements IListProductsResponse - * @constructor - * @param {google.cloud.vision.v1.IListProductsResponse=} [properties] Properties to set - */ - function ListProductsResponse(properties) { - this.products = []; - 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]]; - } - - /** - * ListProductsResponse products. - * @member {Array.} products - * @memberof google.cloud.vision.v1.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1.IListProductsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ListProductsResponse} ListProductsResponse instance - */ - ListProductsResponse.create = function create(properties) { - return new ListProductsResponse(properties); - }; - - /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.vision.v1.ListProductsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1.IListProductsResponse} message ListProductsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.vision.v1.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1.IListProductsResponse} message ListProductsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ListProductsResponse - * @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.ListProductsResponse} ListProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsResponse.decode = function decode(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.ListProductsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.vision.v1.Product.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ListProductsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ListProductsResponse} ListProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsResponse message. - * @function verify - * @memberof google.cloud.vision.v1.ListProductsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.vision.v1.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ListProductsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ListProductsResponse} ListProductsResponse - */ - ListProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ListProductsResponse) - return object; - var message = new $root.google.cloud.vision.v1.ListProductsResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.vision.v1.ListProductsResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ListProductsResponse.products: object expected"); - message.products[i] = $root.google.cloud.vision.v1.Product.fromObject(object.products[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1.ListProductsResponse} message ListProductsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.vision.v1.Product.toObject(message.products[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ListProductsResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ListProductsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ListProductsResponse"; - }; - - return ListProductsResponse; - })(); - - v1.GetProductRequest = (function() { - - /** - * Properties of a GetProductRequest. - * @memberof google.cloud.vision.v1 - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name - */ - - /** - * Constructs a new GetProductRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest - * @constructor - * @param {google.cloud.vision.v1.IGetProductRequest=} [properties] Properties to set - */ - function GetProductRequest(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]]; - } - - /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.GetProductRequest - * @instance - */ - GetProductRequest.prototype.name = ""; - - /** - * Creates a new GetProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.GetProductRequest - * @static - * @param {google.cloud.vision.v1.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.GetProductRequest} GetProductRequest instance - */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); - }; - - /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.vision.v1.GetProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.GetProductRequest - * @static - * @param {google.cloud.vision.v1.IGetProductRequest} message GetProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GetProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.GetProductRequest - * @static - * @param {google.cloud.vision.v1.IGetProductRequest} message GetProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.GetProductRequest - * @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.GetProductRequest} GetProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductRequest.decode = function decode(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.GetProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.GetProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.GetProductRequest} GetProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1.GetProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.GetProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.GetProductRequest} GetProductRequest - */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.GetProductRequest) - return object; - var message = new $root.google.cloud.vision.v1.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.GetProductRequest - * @static - * @param {google.cloud.vision.v1.GetProductRequest} message GetProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.GetProductRequest - * @instance - * @returns {Object.} JSON object - */ - GetProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.GetProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.GetProductRequest"; - }; - - return GetProductRequest; - })(); - - v1.UpdateProductRequest = (function() { - - /** - * Properties of an UpdateProductRequest. - * @memberof google.cloud.vision.v1 - * @interface IUpdateProductRequest - * @property {google.cloud.vision.v1.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask - */ - - /** - * Constructs a new UpdateProductRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest - * @constructor - * @param {google.cloud.vision.v1.IUpdateProductRequest=} [properties] Properties to set - */ - function UpdateProductRequest(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]]; - } - - /** - * UpdateProductRequest product. - * @member {google.cloud.vision.v1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.product = null; - - /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.UpdateProductRequest} UpdateProductRequest instance - */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); - }; - - /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.vision.v1.UpdateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.UpdateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @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.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductRequest.decode = function decode(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.UpdateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.product = $root.google.cloud.vision.v1.Product.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UpdateProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; - - /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.UpdateProductRequest} UpdateProductRequest - */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.UpdateProductRequest) - return object; - var message = new $root.google.cloud.vision.v1.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.vision.v1.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.vision.v1.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; - - /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1.UpdateProductRequest} message UpdateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; - - /** - * Converts this UpdateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdateProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.UpdateProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.UpdateProductRequest"; - }; - - return UpdateProductRequest; - })(); - - v1.DeleteProductRequest = (function() { - - /** - * Properties of a DeleteProductRequest. - * @memberof google.cloud.vision.v1 - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name - */ - - /** - * Constructs a new DeleteProductRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest - * @constructor - * @param {google.cloud.vision.v1.IDeleteProductRequest=} [properties] Properties to set - */ - function DeleteProductRequest(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]]; - } - - /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @instance - */ - DeleteProductRequest.prototype.name = ""; - - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.DeleteProductRequest} DeleteProductRequest instance - */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); - }; - - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.vision.v1.DeleteProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.DeleteProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @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.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decode = function decode(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.DeleteProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.DeleteProductRequest} DeleteProductRequest - */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.DeleteProductRequest) - return object; - var message = new $root.google.cloud.vision.v1.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1.DeleteProductRequest} message DeleteProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.DeleteProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.DeleteProductRequest"; - }; - - return DeleteProductRequest; - })(); - - v1.CreateProductSetRequest = (function() { - - /** - * Properties of a CreateProductSetRequest. - * @memberof google.cloud.vision.v1 - * @interface ICreateProductSetRequest - * @property {string|null} [parent] CreateProductSetRequest parent - * @property {google.cloud.vision.v1.IProductSet|null} [productSet] CreateProductSetRequest productSet - * @property {string|null} [productSetId] CreateProductSetRequest productSetId - */ - - /** - * Constructs a new CreateProductSetRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a CreateProductSetRequest. - * @implements ICreateProductSetRequest - * @constructor - * @param {google.cloud.vision.v1.ICreateProductSetRequest=} [properties] Properties to set - */ - function CreateProductSetRequest(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]]; - } - - /** - * CreateProductSetRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.parent = ""; - - /** - * CreateProductSetRequest productSet. - * @member {google.cloud.vision.v1.IProductSet|null|undefined} productSet - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.productSet = null; - - /** - * CreateProductSetRequest productSetId. - * @member {string} productSetId - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.productSetId = ""; - - /** - * Creates a new CreateProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1.ICreateProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CreateProductSetRequest} CreateProductSetRequest instance - */ - CreateProductSetRequest.create = function create(properties) { - return new CreateProductSetRequest(properties); - }; - - /** - * Encodes the specified CreateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.CreateProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1.ICreateProductSetRequest} message CreateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - $root.google.cloud.vision.v1.ProductSet.encode(message.productSet, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productSetId != null && Object.hasOwnProperty.call(message, "productSetId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productSetId); - return writer; - }; - - /** - * Encodes the specified CreateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CreateProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1.ICreateProductSetRequest} message CreateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @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.CreateProductSetRequest} CreateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductSetRequest.decode = function decode(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.CreateProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.productSet = $root.google.cloud.vision.v1.ProductSet.decode(reader, reader.uint32()); - break; - } - case 3: { - message.productSetId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.CreateProductSetRequest} CreateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.productSet != null && message.hasOwnProperty("productSet")) { - var error = $root.google.cloud.vision.v1.ProductSet.verify(message.productSet); - if (error) - return "productSet." + error; - } - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - if (!$util.isString(message.productSetId)) - return "productSetId: string expected"; - return null; - }; - - /** - * Creates a CreateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CreateProductSetRequest} CreateProductSetRequest - */ - CreateProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CreateProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1.CreateProductSetRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.productSet != null) { - if (typeof object.productSet !== "object") - throw TypeError(".google.cloud.vision.v1.CreateProductSetRequest.productSet: object expected"); - message.productSet = $root.google.cloud.vision.v1.ProductSet.fromObject(object.productSet); - } - if (object.productSetId != null) - message.productSetId = String(object.productSetId); - return message; - }; - - /** - * Creates a plain object from a CreateProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1.CreateProductSetRequest} message CreateProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.productSet = null; - object.productSetId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = $root.google.cloud.vision.v1.ProductSet.toObject(message.productSet, options); - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - object.productSetId = message.productSetId; - return object; - }; - - /** - * Converts this CreateProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - CreateProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.CreateProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.CreateProductSetRequest"; - }; - - return CreateProductSetRequest; - })(); - - v1.ListProductSetsRequest = (function() { - - /** - * Properties of a ListProductSetsRequest. - * @memberof google.cloud.vision.v1 - * @interface IListProductSetsRequest - * @property {string|null} [parent] ListProductSetsRequest parent - * @property {number|null} [pageSize] ListProductSetsRequest pageSize - * @property {string|null} [pageToken] ListProductSetsRequest pageToken - */ - - /** - * Constructs a new ListProductSetsRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ListProductSetsRequest. - * @implements IListProductSetsRequest - * @constructor - * @param {google.cloud.vision.v1.IListProductSetsRequest=} [properties] Properties to set - */ - function ListProductSetsRequest(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]]; - } - - /** - * ListProductSetsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.parent = ""; - - /** - * ListProductSetsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.pageSize = 0; - - /** - * ListProductSetsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductSetsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1.IListProductSetsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ListProductSetsRequest} ListProductSetsRequest instance - */ - ListProductSetsRequest.create = function create(properties) { - return new ListProductSetsRequest(properties); - }; - - /** - * Encodes the specified ListProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1.ListProductSetsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1.IListProductSetsRequest} message ListProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductSetsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1.IListProductSetsRequest} message ListProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @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.ListProductSetsRequest} ListProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsRequest.decode = function decode(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.ListProductSetsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ListProductSetsRequest} ListProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductSetsRequest message. - * @function verify - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductSetsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ListProductSetsRequest} ListProductSetsRequest - */ - ListProductSetsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ListProductSetsRequest) - return object; - var message = new $root.google.cloud.vision.v1.ListProductSetsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductSetsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1.ListProductSetsRequest} message ListProductSetsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductSetsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductSetsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductSetsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductSetsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ListProductSetsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductSetsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ListProductSetsRequest"; - }; - - return ListProductSetsRequest; - })(); - - v1.ListProductSetsResponse = (function() { - - /** - * Properties of a ListProductSetsResponse. - * @memberof google.cloud.vision.v1 - * @interface IListProductSetsResponse - * @property {Array.|null} [productSets] ListProductSetsResponse productSets - * @property {string|null} [nextPageToken] ListProductSetsResponse nextPageToken - */ - - /** - * Constructs a new ListProductSetsResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ListProductSetsResponse. - * @implements IListProductSetsResponse - * @constructor - * @param {google.cloud.vision.v1.IListProductSetsResponse=} [properties] Properties to set - */ - function ListProductSetsResponse(properties) { - this.productSets = []; - 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]]; - } - - /** - * ListProductSetsResponse productSets. - * @member {Array.} productSets - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @instance - */ - ListProductSetsResponse.prototype.productSets = $util.emptyArray; - - /** - * ListProductSetsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @instance - */ - ListProductSetsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductSetsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1.IListProductSetsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ListProductSetsResponse} ListProductSetsResponse instance - */ - ListProductSetsResponse.create = function create(properties) { - return new ListProductSetsResponse(properties); - }; - - /** - * Encodes the specified ListProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1.ListProductSetsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1.IListProductSetsResponse} message ListProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSets != null && message.productSets.length) - for (var i = 0; i < message.productSets.length; ++i) - $root.google.cloud.vision.v1.ProductSet.encode(message.productSets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductSetsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1.IListProductSetsResponse} message ListProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @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.ListProductSetsResponse} ListProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsResponse.decode = function decode(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.ListProductSetsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.productSets && message.productSets.length)) - message.productSets = []; - message.productSets.push($root.google.cloud.vision.v1.ProductSet.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ListProductSetsResponse} ListProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductSetsResponse message. - * @function verify - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductSetsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.productSets != null && message.hasOwnProperty("productSets")) { - if (!Array.isArray(message.productSets)) - return "productSets: array expected"; - for (var i = 0; i < message.productSets.length; ++i) { - var error = $root.google.cloud.vision.v1.ProductSet.verify(message.productSets[i]); - if (error) - return "productSets." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ListProductSetsResponse} ListProductSetsResponse - */ - ListProductSetsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ListProductSetsResponse) - return object; - var message = new $root.google.cloud.vision.v1.ListProductSetsResponse(); - if (object.productSets) { - if (!Array.isArray(object.productSets)) - throw TypeError(".google.cloud.vision.v1.ListProductSetsResponse.productSets: array expected"); - message.productSets = []; - for (var i = 0; i < object.productSets.length; ++i) { - if (typeof object.productSets[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ListProductSetsResponse.productSets: object expected"); - message.productSets[i] = $root.google.cloud.vision.v1.ProductSet.fromObject(object.productSets[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductSetsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1.ListProductSetsResponse} message ListProductSetsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductSetsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productSets = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.productSets && message.productSets.length) { - object.productSets = []; - for (var j = 0; j < message.productSets.length; ++j) - object.productSets[j] = $root.google.cloud.vision.v1.ProductSet.toObject(message.productSets[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductSetsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductSetsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductSetsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ListProductSetsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductSetsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ListProductSetsResponse"; - }; - - return ListProductSetsResponse; - })(); - - v1.GetProductSetRequest = (function() { - - /** - * Properties of a GetProductSetRequest. - * @memberof google.cloud.vision.v1 - * @interface IGetProductSetRequest - * @property {string|null} [name] GetProductSetRequest name - */ - - /** - * Constructs a new GetProductSetRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a GetProductSetRequest. - * @implements IGetProductSetRequest - * @constructor - * @param {google.cloud.vision.v1.IGetProductSetRequest=} [properties] Properties to set - */ - function GetProductSetRequest(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]]; - } - - /** - * GetProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @instance - */ - GetProductSetRequest.prototype.name = ""; - - /** - * Creates a new GetProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1.IGetProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.GetProductSetRequest} GetProductSetRequest instance - */ - GetProductSetRequest.create = function create(properties) { - return new GetProductSetRequest(properties); - }; - - /** - * Encodes the specified GetProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.GetProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1.IGetProductSetRequest} message GetProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GetProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1.IGetProductSetRequest} message GetProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @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.GetProductSetRequest} GetProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductSetRequest.decode = function decode(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.GetProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.GetProductSetRequest} GetProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.GetProductSetRequest} GetProductSetRequest - */ - GetProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.GetProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1.GetProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1.GetProductSetRequest} message GetProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - GetProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.GetProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.GetProductSetRequest"; - }; - - return GetProductSetRequest; - })(); - - v1.UpdateProductSetRequest = (function() { - - /** - * Properties of an UpdateProductSetRequest. - * @memberof google.cloud.vision.v1 - * @interface IUpdateProductSetRequest - * @property {google.cloud.vision.v1.IProductSet|null} [productSet] UpdateProductSetRequest productSet - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductSetRequest updateMask - */ - - /** - * Constructs a new UpdateProductSetRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an UpdateProductSetRequest. - * @implements IUpdateProductSetRequest - * @constructor - * @param {google.cloud.vision.v1.IUpdateProductSetRequest=} [properties] Properties to set - */ - function UpdateProductSetRequest(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]]; - } - - /** - * UpdateProductSetRequest productSet. - * @member {google.cloud.vision.v1.IProductSet|null|undefined} productSet - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @instance - */ - UpdateProductSetRequest.prototype.productSet = null; - - /** - * UpdateProductSetRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @instance - */ - UpdateProductSetRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1.IUpdateProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.UpdateProductSetRequest} UpdateProductSetRequest instance - */ - UpdateProductSetRequest.create = function create(properties) { - return new UpdateProductSetRequest(properties); - }; - - /** - * Encodes the specified UpdateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.UpdateProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1.IUpdateProductSetRequest} message UpdateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - $root.google.cloud.vision.v1.ProductSet.encode(message.productSet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.UpdateProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1.IUpdateProductSetRequest} message UpdateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @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.UpdateProductSetRequest} UpdateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductSetRequest.decode = function decode(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.UpdateProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.productSet = $root.google.cloud.vision.v1.ProductSet.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.UpdateProductSetRequest} UpdateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UpdateProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.productSet != null && message.hasOwnProperty("productSet")) { - var error = $root.google.cloud.vision.v1.ProductSet.verify(message.productSet); - if (error) - return "productSet." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; - - /** - * Creates an UpdateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.UpdateProductSetRequest} UpdateProductSetRequest - */ - UpdateProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.UpdateProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1.UpdateProductSetRequest(); - if (object.productSet != null) { - if (typeof object.productSet !== "object") - throw TypeError(".google.cloud.vision.v1.UpdateProductSetRequest.productSet: object expected"); - message.productSet = $root.google.cloud.vision.v1.ProductSet.fromObject(object.productSet); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.vision.v1.UpdateProductSetRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; - - /** - * Creates a plain object from an UpdateProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1.UpdateProductSetRequest} message UpdateProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.productSet = null; - object.updateMask = null; - } - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = $root.google.cloud.vision.v1.ProductSet.toObject(message.productSet, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; - - /** - * Converts this UpdateProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdateProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.UpdateProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdateProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.UpdateProductSetRequest"; - }; - - return UpdateProductSetRequest; - })(); - - v1.DeleteProductSetRequest = (function() { - - /** - * Properties of a DeleteProductSetRequest. - * @memberof google.cloud.vision.v1 - * @interface IDeleteProductSetRequest - * @property {string|null} [name] DeleteProductSetRequest name - */ - - /** - * Constructs a new DeleteProductSetRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a DeleteProductSetRequest. - * @implements IDeleteProductSetRequest - * @constructor - * @param {google.cloud.vision.v1.IDeleteProductSetRequest=} [properties] Properties to set - */ - function DeleteProductSetRequest(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]]; - } - - /** - * DeleteProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @instance - */ - DeleteProductSetRequest.prototype.name = ""; - - /** - * Creates a new DeleteProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1.IDeleteProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.DeleteProductSetRequest} DeleteProductSetRequest instance - */ - DeleteProductSetRequest.create = function create(properties) { - return new DeleteProductSetRequest(properties); - }; - - /** - * Encodes the specified DeleteProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.DeleteProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1.IDeleteProductSetRequest} message DeleteProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.DeleteProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1.IDeleteProductSetRequest} message DeleteProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @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.DeleteProductSetRequest} DeleteProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductSetRequest.decode = function decode(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.DeleteProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.DeleteProductSetRequest} DeleteProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.DeleteProductSetRequest} DeleteProductSetRequest - */ - DeleteProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.DeleteProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1.DeleteProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1.DeleteProductSetRequest} message DeleteProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.DeleteProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.DeleteProductSetRequest"; - }; - - return DeleteProductSetRequest; - })(); - - v1.CreateReferenceImageRequest = (function() { - - /** - * Properties of a CreateReferenceImageRequest. - * @memberof google.cloud.vision.v1 - * @interface ICreateReferenceImageRequest - * @property {string|null} [parent] CreateReferenceImageRequest parent - * @property {google.cloud.vision.v1.IReferenceImage|null} [referenceImage] CreateReferenceImageRequest referenceImage - * @property {string|null} [referenceImageId] CreateReferenceImageRequest referenceImageId - */ - - /** - * Constructs a new CreateReferenceImageRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a CreateReferenceImageRequest. - * @implements ICreateReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1.ICreateReferenceImageRequest=} [properties] Properties to set - */ - function CreateReferenceImageRequest(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]]; - } - - /** - * CreateReferenceImageRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.parent = ""; - - /** - * CreateReferenceImageRequest referenceImage. - * @member {google.cloud.vision.v1.IReferenceImage|null|undefined} referenceImage - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.referenceImage = null; - - /** - * CreateReferenceImageRequest referenceImageId. - * @member {string} referenceImageId - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.referenceImageId = ""; - - /** - * Creates a new CreateReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.ICreateReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CreateReferenceImageRequest} CreateReferenceImageRequest instance - */ - CreateReferenceImageRequest.create = function create(properties) { - return new CreateReferenceImageRequest(properties); - }; - - /** - * Encodes the specified CreateReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1.CreateReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.ICreateReferenceImageRequest} message CreateReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.referenceImage != null && Object.hasOwnProperty.call(message, "referenceImage")) - $root.google.cloud.vision.v1.ReferenceImage.encode(message.referenceImage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.referenceImageId != null && Object.hasOwnProperty.call(message, "referenceImageId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.referenceImageId); - return writer; - }; - - /** - * Encodes the specified CreateReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CreateReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.ICreateReferenceImageRequest} message CreateReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @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.CreateReferenceImageRequest} CreateReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateReferenceImageRequest.decode = function decode(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.CreateReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.referenceImage = $root.google.cloud.vision.v1.ReferenceImage.decode(reader, reader.uint32()); - break; - } - case 3: { - message.referenceImageId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.CreateReferenceImageRequest} CreateReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.referenceImage != null && message.hasOwnProperty("referenceImage")) { - var error = $root.google.cloud.vision.v1.ReferenceImage.verify(message.referenceImage); - if (error) - return "referenceImage." + error; - } - if (message.referenceImageId != null && message.hasOwnProperty("referenceImageId")) - if (!$util.isString(message.referenceImageId)) - return "referenceImageId: string expected"; - return null; - }; - - /** - * Creates a CreateReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CreateReferenceImageRequest} CreateReferenceImageRequest - */ - CreateReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CreateReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1.CreateReferenceImageRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.referenceImage != null) { - if (typeof object.referenceImage !== "object") - throw TypeError(".google.cloud.vision.v1.CreateReferenceImageRequest.referenceImage: object expected"); - message.referenceImage = $root.google.cloud.vision.v1.ReferenceImage.fromObject(object.referenceImage); - } - if (object.referenceImageId != null) - message.referenceImageId = String(object.referenceImageId); - return message; - }; - - /** - * Creates a plain object from a CreateReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.CreateReferenceImageRequest} message CreateReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.referenceImage = null; - object.referenceImageId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.referenceImage != null && message.hasOwnProperty("referenceImage")) - object.referenceImage = $root.google.cloud.vision.v1.ReferenceImage.toObject(message.referenceImage, options); - if (message.referenceImageId != null && message.hasOwnProperty("referenceImageId")) - object.referenceImageId = message.referenceImageId; - return object; - }; - - /** - * Converts this CreateReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - CreateReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.CreateReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.CreateReferenceImageRequest"; - }; - - return CreateReferenceImageRequest; - })(); - - v1.ListReferenceImagesRequest = (function() { - - /** - * Properties of a ListReferenceImagesRequest. - * @memberof google.cloud.vision.v1 - * @interface IListReferenceImagesRequest - * @property {string|null} [parent] ListReferenceImagesRequest parent - * @property {number|null} [pageSize] ListReferenceImagesRequest pageSize - * @property {string|null} [pageToken] ListReferenceImagesRequest pageToken - */ - - /** - * Constructs a new ListReferenceImagesRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ListReferenceImagesRequest. - * @implements IListReferenceImagesRequest - * @constructor - * @param {google.cloud.vision.v1.IListReferenceImagesRequest=} [properties] Properties to set - */ - function ListReferenceImagesRequest(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]]; - } - - /** - * ListReferenceImagesRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.parent = ""; - - /** - * ListReferenceImagesRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.pageSize = 0; - - /** - * ListReferenceImagesRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.pageToken = ""; - - /** - * Creates a new ListReferenceImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1.IListReferenceImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ListReferenceImagesRequest} ListReferenceImagesRequest instance - */ - ListReferenceImagesRequest.create = function create(properties) { - return new ListReferenceImagesRequest(properties); - }; - - /** - * Encodes the specified ListReferenceImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.ListReferenceImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1.IListReferenceImagesRequest} message ListReferenceImagesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListReferenceImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListReferenceImagesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1.IListReferenceImagesRequest} message ListReferenceImagesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @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.ListReferenceImagesRequest} ListReferenceImagesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesRequest.decode = function decode(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.ListReferenceImagesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ListReferenceImagesRequest} ListReferenceImagesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListReferenceImagesRequest message. - * @function verify - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListReferenceImagesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListReferenceImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ListReferenceImagesRequest} ListReferenceImagesRequest - */ - ListReferenceImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ListReferenceImagesRequest) - return object; - var message = new $root.google.cloud.vision.v1.ListReferenceImagesRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListReferenceImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1.ListReferenceImagesRequest} message ListReferenceImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListReferenceImagesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListReferenceImagesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @instance - * @returns {Object.} JSON object - */ - ListReferenceImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListReferenceImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ListReferenceImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListReferenceImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ListReferenceImagesRequest"; - }; - - return ListReferenceImagesRequest; - })(); - - v1.ListReferenceImagesResponse = (function() { - - /** - * Properties of a ListReferenceImagesResponse. - * @memberof google.cloud.vision.v1 - * @interface IListReferenceImagesResponse - * @property {Array.|null} [referenceImages] ListReferenceImagesResponse referenceImages - * @property {number|null} [pageSize] ListReferenceImagesResponse pageSize - * @property {string|null} [nextPageToken] ListReferenceImagesResponse nextPageToken - */ - - /** - * Constructs a new ListReferenceImagesResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ListReferenceImagesResponse. - * @implements IListReferenceImagesResponse - * @constructor - * @param {google.cloud.vision.v1.IListReferenceImagesResponse=} [properties] Properties to set - */ - function ListReferenceImagesResponse(properties) { - this.referenceImages = []; - 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]]; - } - - /** - * ListReferenceImagesResponse referenceImages. - * @member {Array.} referenceImages - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.referenceImages = $util.emptyArray; - - /** - * ListReferenceImagesResponse pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.pageSize = 0; - - /** - * ListReferenceImagesResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListReferenceImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1.IListReferenceImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ListReferenceImagesResponse} ListReferenceImagesResponse instance - */ - ListReferenceImagesResponse.create = function create(properties) { - return new ListReferenceImagesResponse(properties); - }; - - /** - * Encodes the specified ListReferenceImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.ListReferenceImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1.IListReferenceImagesResponse} message ListReferenceImagesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.referenceImages != null && message.referenceImages.length) - for (var i = 0; i < message.referenceImages.length; ++i) - $root.google.cloud.vision.v1.ReferenceImage.encode(message.referenceImages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListReferenceImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListReferenceImagesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1.IListReferenceImagesResponse} message ListReferenceImagesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @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.ListReferenceImagesResponse} ListReferenceImagesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesResponse.decode = function decode(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.ListReferenceImagesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.referenceImages && message.referenceImages.length)) - message.referenceImages = []; - message.referenceImages.push($root.google.cloud.vision.v1.ReferenceImage.decode(reader, reader.uint32())); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ListReferenceImagesResponse} ListReferenceImagesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListReferenceImagesResponse message. - * @function verify - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListReferenceImagesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.referenceImages != null && message.hasOwnProperty("referenceImages")) { - if (!Array.isArray(message.referenceImages)) - return "referenceImages: array expected"; - for (var i = 0; i < message.referenceImages.length; ++i) { - var error = $root.google.cloud.vision.v1.ReferenceImage.verify(message.referenceImages[i]); - if (error) - return "referenceImages." + error; - } - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListReferenceImagesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ListReferenceImagesResponse} ListReferenceImagesResponse - */ - ListReferenceImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ListReferenceImagesResponse) - return object; - var message = new $root.google.cloud.vision.v1.ListReferenceImagesResponse(); - if (object.referenceImages) { - if (!Array.isArray(object.referenceImages)) - throw TypeError(".google.cloud.vision.v1.ListReferenceImagesResponse.referenceImages: array expected"); - message.referenceImages = []; - for (var i = 0; i < object.referenceImages.length; ++i) { - if (typeof object.referenceImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ListReferenceImagesResponse.referenceImages: object expected"); - message.referenceImages[i] = $root.google.cloud.vision.v1.ReferenceImage.fromObject(object.referenceImages[i]); - } - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListReferenceImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1.ListReferenceImagesResponse} message ListReferenceImagesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListReferenceImagesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.referenceImages = []; - if (options.defaults) { - object.pageSize = 0; - object.nextPageToken = ""; - } - if (message.referenceImages && message.referenceImages.length) { - object.referenceImages = []; - for (var j = 0; j < message.referenceImages.length; ++j) - object.referenceImages[j] = $root.google.cloud.vision.v1.ReferenceImage.toObject(message.referenceImages[j], options); - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListReferenceImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @instance - * @returns {Object.} JSON object - */ - ListReferenceImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListReferenceImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ListReferenceImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListReferenceImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ListReferenceImagesResponse"; - }; - - return ListReferenceImagesResponse; - })(); - - v1.GetReferenceImageRequest = (function() { - - /** - * Properties of a GetReferenceImageRequest. - * @memberof google.cloud.vision.v1 - * @interface IGetReferenceImageRequest - * @property {string|null} [name] GetReferenceImageRequest name - */ - - /** - * Constructs a new GetReferenceImageRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a GetReferenceImageRequest. - * @implements IGetReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1.IGetReferenceImageRequest=} [properties] Properties to set - */ - function GetReferenceImageRequest(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]]; - } - - /** - * GetReferenceImageRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @instance - */ - GetReferenceImageRequest.prototype.name = ""; - - /** - * Creates a new GetReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.IGetReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.GetReferenceImageRequest} GetReferenceImageRequest instance - */ - GetReferenceImageRequest.create = function create(properties) { - return new GetReferenceImageRequest(properties); - }; - - /** - * Encodes the specified GetReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1.GetReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.IGetReferenceImageRequest} message GetReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GetReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.IGetReferenceImageRequest} message GetReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @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.GetReferenceImageRequest} GetReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetReferenceImageRequest.decode = function decode(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.GetReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.GetReferenceImageRequest} GetReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.GetReferenceImageRequest} GetReferenceImageRequest - */ - GetReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.GetReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1.GetReferenceImageRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.GetReferenceImageRequest} message GetReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - GetReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.GetReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.GetReferenceImageRequest"; - }; - - return GetReferenceImageRequest; - })(); - - v1.DeleteReferenceImageRequest = (function() { - - /** - * Properties of a DeleteReferenceImageRequest. - * @memberof google.cloud.vision.v1 - * @interface IDeleteReferenceImageRequest - * @property {string|null} [name] DeleteReferenceImageRequest name - */ - - /** - * Constructs a new DeleteReferenceImageRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a DeleteReferenceImageRequest. - * @implements IDeleteReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1.IDeleteReferenceImageRequest=} [properties] Properties to set - */ - function DeleteReferenceImageRequest(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]]; - } - - /** - * DeleteReferenceImageRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @instance - */ - DeleteReferenceImageRequest.prototype.name = ""; - - /** - * Creates a new DeleteReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.IDeleteReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.DeleteReferenceImageRequest} DeleteReferenceImageRequest instance - */ - DeleteReferenceImageRequest.create = function create(properties) { - return new DeleteReferenceImageRequest(properties); - }; - - /** - * Encodes the specified DeleteReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1.DeleteReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.IDeleteReferenceImageRequest} message DeleteReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.DeleteReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.IDeleteReferenceImageRequest} message DeleteReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest} DeleteReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteReferenceImageRequest.decode = function decode(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.DeleteReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.DeleteReferenceImageRequest} DeleteReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.DeleteReferenceImageRequest} DeleteReferenceImageRequest - */ - DeleteReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.DeleteReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1.DeleteReferenceImageRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1.DeleteReferenceImageRequest} message DeleteReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.DeleteReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.DeleteReferenceImageRequest"; - }; - - return DeleteReferenceImageRequest; - })(); - - v1.AddProductToProductSetRequest = (function() { - - /** - * Properties of an AddProductToProductSetRequest. - * @memberof google.cloud.vision.v1 - * @interface IAddProductToProductSetRequest - * @property {string|null} [name] AddProductToProductSetRequest name - * @property {string|null} [product] AddProductToProductSetRequest product - */ - - /** - * Constructs a new AddProductToProductSetRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AddProductToProductSetRequest. - * @implements IAddProductToProductSetRequest - * @constructor - * @param {google.cloud.vision.v1.IAddProductToProductSetRequest=} [properties] Properties to set - */ - function AddProductToProductSetRequest(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]]; - } - - /** - * AddProductToProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @instance - */ - AddProductToProductSetRequest.prototype.name = ""; - - /** - * AddProductToProductSetRequest product. - * @member {string} product - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @instance - */ - AddProductToProductSetRequest.prototype.product = ""; - - /** - * Creates a new AddProductToProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1.IAddProductToProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AddProductToProductSetRequest} AddProductToProductSetRequest instance - */ - AddProductToProductSetRequest.create = function create(properties) { - return new AddProductToProductSetRequest(properties); - }; - - /** - * Encodes the specified AddProductToProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.AddProductToProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1.IAddProductToProductSetRequest} message AddProductToProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddProductToProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.product); - return writer; - }; - - /** - * Encodes the specified AddProductToProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AddProductToProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1.IAddProductToProductSetRequest} message AddProductToProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddProductToProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @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.AddProductToProductSetRequest} AddProductToProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AddProductToProductSetRequest.decode = function decode(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.AddProductToProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.product = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AddProductToProductSetRequest} AddProductToProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AddProductToProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AddProductToProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AddProductToProductSetRequest.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.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - return null; - }; - - /** - * Creates an AddProductToProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AddProductToProductSetRequest} AddProductToProductSetRequest - */ - AddProductToProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AddProductToProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1.AddProductToProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.product != null) - message.product = String(object.product); - return message; - }; - - /** - * Creates a plain object from an AddProductToProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1.AddProductToProductSetRequest} message AddProductToProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AddProductToProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.product = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - return object; - }; - - /** - * Converts this AddProductToProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - AddProductToProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AddProductToProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.AddProductToProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AddProductToProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.AddProductToProductSetRequest"; - }; - - return AddProductToProductSetRequest; - })(); - - v1.RemoveProductFromProductSetRequest = (function() { - - /** - * Properties of a RemoveProductFromProductSetRequest. - * @memberof google.cloud.vision.v1 - * @interface IRemoveProductFromProductSetRequest - * @property {string|null} [name] RemoveProductFromProductSetRequest name - * @property {string|null} [product] RemoveProductFromProductSetRequest product - */ - - /** - * Constructs a new RemoveProductFromProductSetRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a RemoveProductFromProductSetRequest. - * @implements IRemoveProductFromProductSetRequest - * @constructor - * @param {google.cloud.vision.v1.IRemoveProductFromProductSetRequest=} [properties] Properties to set - */ - function RemoveProductFromProductSetRequest(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]]; - } - - /** - * RemoveProductFromProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @instance - */ - RemoveProductFromProductSetRequest.prototype.name = ""; - - /** - * RemoveProductFromProductSetRequest product. - * @member {string} product - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @instance - */ - RemoveProductFromProductSetRequest.prototype.product = ""; - - /** - * Creates a new RemoveProductFromProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1.IRemoveProductFromProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest instance - */ - RemoveProductFromProductSetRequest.create = function create(properties) { - return new RemoveProductFromProductSetRequest(properties); - }; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1.IRemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RemoveProductFromProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.product); - return writer; - }; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1.IRemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RemoveProductFromProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RemoveProductFromProductSetRequest.decode = function decode(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.RemoveProductFromProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.product = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RemoveProductFromProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RemoveProductFromProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RemoveProductFromProductSetRequest.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.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - return null; - }; - - /** - * Creates a RemoveProductFromProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - */ - RemoveProductFromProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.RemoveProductFromProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1.RemoveProductFromProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.product != null) - message.product = String(object.product); - return message; - }; - - /** - * Creates a plain object from a RemoveProductFromProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1.RemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RemoveProductFromProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.product = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - return object; - }; - - /** - * Converts this RemoveProductFromProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - RemoveProductFromProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RemoveProductFromProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.RemoveProductFromProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RemoveProductFromProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.RemoveProductFromProductSetRequest"; - }; - - return RemoveProductFromProductSetRequest; - })(); - - v1.ListProductsInProductSetRequest = (function() { - - /** - * Properties of a ListProductsInProductSetRequest. - * @memberof google.cloud.vision.v1 - * @interface IListProductsInProductSetRequest - * @property {string|null} [name] ListProductsInProductSetRequest name - * @property {number|null} [pageSize] ListProductsInProductSetRequest pageSize - * @property {string|null} [pageToken] ListProductsInProductSetRequest pageToken - */ - - /** - * Constructs a new ListProductsInProductSetRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ListProductsInProductSetRequest. - * @implements IListProductsInProductSetRequest - * @constructor - * @param {google.cloud.vision.v1.IListProductsInProductSetRequest=} [properties] Properties to set - */ - function ListProductsInProductSetRequest(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]]; - } - - /** - * ListProductsInProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.name = ""; - - /** - * ListProductsInProductSetRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.pageSize = 0; - - /** - * ListProductsInProductSetRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductsInProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1.IListProductsInProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ListProductsInProductSetRequest} ListProductsInProductSetRequest instance - */ - ListProductsInProductSetRequest.create = function create(properties) { - return new ListProductsInProductSetRequest(properties); - }; - - /** - * Encodes the specified ListProductsInProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1.ListProductsInProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1.IListProductsInProductSetRequest} message ListProductsInProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsInProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductsInProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1.IListProductsInProductSetRequest} message ListProductsInProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest} ListProductsInProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetRequest.decode = function decode(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.ListProductsInProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ListProductsInProductSetRequest} ListProductsInProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsInProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsInProductSetRequest.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.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsInProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ListProductsInProductSetRequest} ListProductsInProductSetRequest - */ - ListProductsInProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ListProductsInProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1.ListProductsInProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsInProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1.ListProductsInProductSetRequest} message ListProductsInProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsInProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductsInProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductsInProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsInProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ListProductsInProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsInProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ListProductsInProductSetRequest"; - }; - - return ListProductsInProductSetRequest; - })(); - - v1.ListProductsInProductSetResponse = (function() { - - /** - * Properties of a ListProductsInProductSetResponse. - * @memberof google.cloud.vision.v1 - * @interface IListProductsInProductSetResponse - * @property {Array.|null} [products] ListProductsInProductSetResponse products - * @property {string|null} [nextPageToken] ListProductsInProductSetResponse nextPageToken - */ - - /** - * Constructs a new ListProductsInProductSetResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ListProductsInProductSetResponse. - * @implements IListProductsInProductSetResponse - * @constructor - * @param {google.cloud.vision.v1.IListProductsInProductSetResponse=} [properties] Properties to set - */ - function ListProductsInProductSetResponse(properties) { - this.products = []; - 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]]; - } - - /** - * ListProductsInProductSetResponse products. - * @member {Array.} products - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @instance - */ - ListProductsInProductSetResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsInProductSetResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @instance - */ - ListProductsInProductSetResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductsInProductSetResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1.IListProductsInProductSetResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ListProductsInProductSetResponse} ListProductsInProductSetResponse instance - */ - ListProductsInProductSetResponse.create = function create(properties) { - return new ListProductsInProductSetResponse(properties); - }; - - /** - * Encodes the specified ListProductsInProductSetResponse message. Does not implicitly {@link google.cloud.vision.v1.ListProductsInProductSetResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1.IListProductsInProductSetResponse} message ListProductsInProductSetResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.vision.v1.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsInProductSetResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ListProductsInProductSetResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1.IListProductsInProductSetResponse} message ListProductsInProductSetResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse} ListProductsInProductSetResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetResponse.decode = function decode(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.ListProductsInProductSetResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.vision.v1.Product.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ListProductsInProductSetResponse} ListProductsInProductSetResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsInProductSetResponse message. - * @function verify - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsInProductSetResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.vision.v1.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsInProductSetResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ListProductsInProductSetResponse} ListProductsInProductSetResponse - */ - ListProductsInProductSetResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ListProductsInProductSetResponse) - return object; - var message = new $root.google.cloud.vision.v1.ListProductsInProductSetResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.vision.v1.ListProductsInProductSetResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ListProductsInProductSetResponse.products: object expected"); - message.products[i] = $root.google.cloud.vision.v1.Product.fromObject(object.products[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsInProductSetResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1.ListProductsInProductSetResponse} message ListProductsInProductSetResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsInProductSetResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.vision.v1.Product.toObject(message.products[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductsInProductSetResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductsInProductSetResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsInProductSetResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ListProductsInProductSetResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsInProductSetResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ListProductsInProductSetResponse"; - }; - - return ListProductsInProductSetResponse; - })(); - - v1.ImportProductSetsGcsSource = (function() { - - /** - * Properties of an ImportProductSetsGcsSource. - * @memberof google.cloud.vision.v1 - * @interface IImportProductSetsGcsSource - * @property {string|null} [csvFileUri] ImportProductSetsGcsSource csvFileUri - */ - - /** - * Constructs a new ImportProductSetsGcsSource. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImportProductSetsGcsSource. - * @implements IImportProductSetsGcsSource - * @constructor - * @param {google.cloud.vision.v1.IImportProductSetsGcsSource=} [properties] Properties to set - */ - function ImportProductSetsGcsSource(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]]; - } - - /** - * ImportProductSetsGcsSource csvFileUri. - * @member {string} csvFileUri - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @instance - */ - ImportProductSetsGcsSource.prototype.csvFileUri = ""; - - /** - * Creates a new ImportProductSetsGcsSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1.IImportProductSetsGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImportProductSetsGcsSource} ImportProductSetsGcsSource instance - */ - ImportProductSetsGcsSource.create = function create(properties) { - return new ImportProductSetsGcsSource(properties); - }; - - /** - * Encodes the specified ImportProductSetsGcsSource message. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsGcsSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1.IImportProductSetsGcsSource} message ImportProductSetsGcsSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsGcsSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.csvFileUri != null && Object.hasOwnProperty.call(message, "csvFileUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.csvFileUri); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsGcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsGcsSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1.IImportProductSetsGcsSource} message ImportProductSetsGcsSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsGcsSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource} ImportProductSetsGcsSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsGcsSource.decode = function decode(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.ImportProductSetsGcsSource(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.csvFileUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ImportProductSetsGcsSource} ImportProductSetsGcsSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsGcsSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsGcsSource message. - * @function verify - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsGcsSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.csvFileUri != null && message.hasOwnProperty("csvFileUri")) - if (!$util.isString(message.csvFileUri)) - return "csvFileUri: string expected"; - return null; - }; - - /** - * Creates an ImportProductSetsGcsSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImportProductSetsGcsSource} ImportProductSetsGcsSource - */ - ImportProductSetsGcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImportProductSetsGcsSource) - return object; - var message = new $root.google.cloud.vision.v1.ImportProductSetsGcsSource(); - if (object.csvFileUri != null) - message.csvFileUri = String(object.csvFileUri); - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsGcsSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1.ImportProductSetsGcsSource} message ImportProductSetsGcsSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsGcsSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.csvFileUri = ""; - if (message.csvFileUri != null && message.hasOwnProperty("csvFileUri")) - object.csvFileUri = message.csvFileUri; - return object; - }; - - /** - * Converts this ImportProductSetsGcsSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsGcsSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsGcsSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ImportProductSetsGcsSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsGcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ImportProductSetsGcsSource"; - }; - - return ImportProductSetsGcsSource; - })(); - - v1.ImportProductSetsInputConfig = (function() { - - /** - * Properties of an ImportProductSetsInputConfig. - * @memberof google.cloud.vision.v1 - * @interface IImportProductSetsInputConfig - * @property {google.cloud.vision.v1.IImportProductSetsGcsSource|null} [gcsSource] ImportProductSetsInputConfig gcsSource - */ - - /** - * Constructs a new ImportProductSetsInputConfig. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImportProductSetsInputConfig. - * @implements IImportProductSetsInputConfig - * @constructor - * @param {google.cloud.vision.v1.IImportProductSetsInputConfig=} [properties] Properties to set - */ - function ImportProductSetsInputConfig(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]]; - } - - /** - * ImportProductSetsInputConfig gcsSource. - * @member {google.cloud.vision.v1.IImportProductSetsGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @instance - */ - ImportProductSetsInputConfig.prototype.gcsSource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ImportProductSetsInputConfig source. - * @member {"gcsSource"|undefined} source - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @instance - */ - Object.defineProperty(ImportProductSetsInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ImportProductSetsInputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1.IImportProductSetsInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImportProductSetsInputConfig} ImportProductSetsInputConfig instance - */ - ImportProductSetsInputConfig.create = function create(properties) { - return new ImportProductSetsInputConfig(properties); - }; - - /** - * Encodes the specified ImportProductSetsInputConfig message. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsInputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1.IImportProductSetsInputConfig} message ImportProductSetsInputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsInputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.vision.v1.ImportProductSetsGcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsInputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsInputConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1.IImportProductSetsInputConfig} message ImportProductSetsInputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsInputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig} ImportProductSetsInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsInputConfig.decode = function decode(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.ImportProductSetsInputConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsSource = $root.google.cloud.vision.v1.ImportProductSetsGcsSource.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ImportProductSetsInputConfig} ImportProductSetsInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsInputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsInputConfig message. - * @function verify - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsInputConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - properties.source = 1; - { - var error = $root.google.cloud.vision.v1.ImportProductSetsGcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - } - return null; - }; - - /** - * Creates an ImportProductSetsInputConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImportProductSetsInputConfig} ImportProductSetsInputConfig - */ - ImportProductSetsInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImportProductSetsInputConfig) - return object; - var message = new $root.google.cloud.vision.v1.ImportProductSetsInputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.vision.v1.ImportProductSetsInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.vision.v1.ImportProductSetsGcsSource.fromObject(object.gcsSource); - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsInputConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1.ImportProductSetsInputConfig} message ImportProductSetsInputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsInputConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.vision.v1.ImportProductSetsGcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - return object; - }; - - /** - * Converts this ImportProductSetsInputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsInputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsInputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ImportProductSetsInputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ImportProductSetsInputConfig"; - }; - - return ImportProductSetsInputConfig; - })(); - - v1.ImportProductSetsRequest = (function() { - - /** - * Properties of an ImportProductSetsRequest. - * @memberof google.cloud.vision.v1 - * @interface IImportProductSetsRequest - * @property {string|null} [parent] ImportProductSetsRequest parent - * @property {google.cloud.vision.v1.IImportProductSetsInputConfig|null} [inputConfig] ImportProductSetsRequest inputConfig - */ - - /** - * Constructs a new ImportProductSetsRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImportProductSetsRequest. - * @implements IImportProductSetsRequest - * @constructor - * @param {google.cloud.vision.v1.IImportProductSetsRequest=} [properties] Properties to set - */ - function ImportProductSetsRequest(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]]; - } - - /** - * ImportProductSetsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @instance - */ - ImportProductSetsRequest.prototype.parent = ""; - - /** - * ImportProductSetsRequest inputConfig. - * @member {google.cloud.vision.v1.IImportProductSetsInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @instance - */ - ImportProductSetsRequest.prototype.inputConfig = null; - - /** - * Creates a new ImportProductSetsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1.IImportProductSetsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImportProductSetsRequest} ImportProductSetsRequest instance - */ - ImportProductSetsRequest.create = function create(properties) { - return new ImportProductSetsRequest(properties); - }; - - /** - * Encodes the specified ImportProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1.IImportProductSetsRequest} message ImportProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.vision.v1.ImportProductSetsInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1.IImportProductSetsRequest} message ImportProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @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.ImportProductSetsRequest} ImportProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsRequest.decode = function decode(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.ImportProductSetsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.inputConfig = $root.google.cloud.vision.v1.ImportProductSetsInputConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ImportProductSetsRequest} ImportProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsRequest message. - * @function verify - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1.ImportProductSetsInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - return null; - }; - - /** - * Creates an ImportProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImportProductSetsRequest} ImportProductSetsRequest - */ - ImportProductSetsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImportProductSetsRequest) - return object; - var message = new $root.google.cloud.vision.v1.ImportProductSetsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1.ImportProductSetsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1.ImportProductSetsInputConfig.fromObject(object.inputConfig); - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1.ImportProductSetsRequest} message ImportProductSetsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = 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.ImportProductSetsInputConfig.toObject(message.inputConfig, options); - return object; - }; - - /** - * Converts this ImportProductSetsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ImportProductSetsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ImportProductSetsRequest"; - }; - - return ImportProductSetsRequest; - })(); - - v1.ImportProductSetsResponse = (function() { - - /** - * Properties of an ImportProductSetsResponse. - * @memberof google.cloud.vision.v1 - * @interface IImportProductSetsResponse - * @property {Array.|null} [referenceImages] ImportProductSetsResponse referenceImages - * @property {Array.|null} [statuses] ImportProductSetsResponse statuses - */ - - /** - * Constructs a new ImportProductSetsResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImportProductSetsResponse. - * @implements IImportProductSetsResponse - * @constructor - * @param {google.cloud.vision.v1.IImportProductSetsResponse=} [properties] Properties to set - */ - function ImportProductSetsResponse(properties) { - this.referenceImages = []; - this.statuses = []; - 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]]; - } - - /** - * ImportProductSetsResponse referenceImages. - * @member {Array.} referenceImages - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @instance - */ - ImportProductSetsResponse.prototype.referenceImages = $util.emptyArray; - - /** - * ImportProductSetsResponse statuses. - * @member {Array.} statuses - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @instance - */ - ImportProductSetsResponse.prototype.statuses = $util.emptyArray; - - /** - * Creates a new ImportProductSetsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1.IImportProductSetsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImportProductSetsResponse} ImportProductSetsResponse instance - */ - ImportProductSetsResponse.create = function create(properties) { - return new ImportProductSetsResponse(properties); - }; - - /** - * Encodes the specified ImportProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1.IImportProductSetsResponse} message ImportProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.referenceImages != null && message.referenceImages.length) - for (var i = 0; i < message.referenceImages.length; ++i) - $root.google.cloud.vision.v1.ReferenceImage.encode(message.referenceImages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.statuses != null && message.statuses.length) - for (var i = 0; i < message.statuses.length; ++i) - $root.google.rpc.Status.encode(message.statuses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImportProductSetsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1.IImportProductSetsResponse} message ImportProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @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.ImportProductSetsResponse} ImportProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsResponse.decode = function decode(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.ImportProductSetsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.referenceImages && message.referenceImages.length)) - message.referenceImages = []; - message.referenceImages.push($root.google.cloud.vision.v1.ReferenceImage.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.statuses && message.statuses.length)) - message.statuses = []; - message.statuses.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ImportProductSetsResponse} ImportProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsResponse message. - * @function verify - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.referenceImages != null && message.hasOwnProperty("referenceImages")) { - if (!Array.isArray(message.referenceImages)) - return "referenceImages: array expected"; - for (var i = 0; i < message.referenceImages.length; ++i) { - var error = $root.google.cloud.vision.v1.ReferenceImage.verify(message.referenceImages[i]); - if (error) - return "referenceImages." + error; - } - } - if (message.statuses != null && message.hasOwnProperty("statuses")) { - if (!Array.isArray(message.statuses)) - return "statuses: array expected"; - for (var i = 0; i < message.statuses.length; ++i) { - var error = $root.google.rpc.Status.verify(message.statuses[i]); - if (error) - return "statuses." + error; - } - } - return null; - }; - - /** - * Creates an ImportProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImportProductSetsResponse} ImportProductSetsResponse - */ - ImportProductSetsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImportProductSetsResponse) - return object; - var message = new $root.google.cloud.vision.v1.ImportProductSetsResponse(); - if (object.referenceImages) { - if (!Array.isArray(object.referenceImages)) - throw TypeError(".google.cloud.vision.v1.ImportProductSetsResponse.referenceImages: array expected"); - message.referenceImages = []; - for (var i = 0; i < object.referenceImages.length; ++i) { - if (typeof object.referenceImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ImportProductSetsResponse.referenceImages: object expected"); - message.referenceImages[i] = $root.google.cloud.vision.v1.ReferenceImage.fromObject(object.referenceImages[i]); - } - } - if (object.statuses) { - if (!Array.isArray(object.statuses)) - throw TypeError(".google.cloud.vision.v1.ImportProductSetsResponse.statuses: array expected"); - message.statuses = []; - for (var i = 0; i < object.statuses.length; ++i) { - if (typeof object.statuses[i] !== "object") - throw TypeError(".google.cloud.vision.v1.ImportProductSetsResponse.statuses: object expected"); - message.statuses[i] = $root.google.rpc.Status.fromObject(object.statuses[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1.ImportProductSetsResponse} message ImportProductSetsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.referenceImages = []; - object.statuses = []; - } - if (message.referenceImages && message.referenceImages.length) { - object.referenceImages = []; - for (var j = 0; j < message.referenceImages.length; ++j) - object.referenceImages[j] = $root.google.cloud.vision.v1.ReferenceImage.toObject(message.referenceImages[j], options); - } - if (message.statuses && message.statuses.length) { - object.statuses = []; - for (var j = 0; j < message.statuses.length; ++j) - object.statuses[j] = $root.google.rpc.Status.toObject(message.statuses[j], options); - } - return object; - }; - - /** - * Converts this ImportProductSetsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ImportProductSetsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ImportProductSetsResponse"; - }; - - return ImportProductSetsResponse; - })(); - - v1.BatchOperationMetadata = (function() { - - /** - * Properties of a BatchOperationMetadata. - * @memberof google.cloud.vision.v1 - * @interface IBatchOperationMetadata - * @property {google.cloud.vision.v1.BatchOperationMetadata.State|null} [state] BatchOperationMetadata state - * @property {google.protobuf.ITimestamp|null} [submitTime] BatchOperationMetadata submitTime - * @property {google.protobuf.ITimestamp|null} [endTime] BatchOperationMetadata endTime - */ - - /** - * Constructs a new BatchOperationMetadata. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchOperationMetadata. - * @implements IBatchOperationMetadata - * @constructor - * @param {google.cloud.vision.v1.IBatchOperationMetadata=} [properties] Properties to set - */ - function BatchOperationMetadata(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]]; - } - - /** - * BatchOperationMetadata state. - * @member {google.cloud.vision.v1.BatchOperationMetadata.State} state - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.state = 0; - - /** - * BatchOperationMetadata submitTime. - * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.submitTime = null; - - /** - * BatchOperationMetadata endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.endTime = null; - - /** - * Creates a new BatchOperationMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1.IBatchOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchOperationMetadata} BatchOperationMetadata instance - */ - BatchOperationMetadata.create = function create(properties) { - return new BatchOperationMetadata(properties); - }; - - /** - * Encodes the specified BatchOperationMetadata message. Does not implicitly {@link google.cloud.vision.v1.BatchOperationMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1.IBatchOperationMetadata} message BatchOperationMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchOperationMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BatchOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchOperationMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1.IBatchOperationMetadata} message BatchOperationMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @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.BatchOperationMetadata} BatchOperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchOperationMetadata.decode = function decode(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.BatchOperationMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.state = reader.int32(); - break; - } - case 2: { - message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.BatchOperationMetadata} BatchOperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchOperationMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchOperationMetadata message. - * @function verify - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BatchOperationMetadata.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.submitTime != null && message.hasOwnProperty("submitTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.submitTime); - if (error) - return "submitTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - return null; - }; - - /** - * Creates a BatchOperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchOperationMetadata} BatchOperationMetadata - */ - BatchOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchOperationMetadata) - return object; - var message = new $root.google.cloud.vision.v1.BatchOperationMetadata(); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "PROCESSING": - case 1: - message.state = 1; - break; - case "SUCCESSFUL": - case 2: - message.state = 2; - break; - case "FAILED": - case 3: - message.state = 3; - break; - case "CANCELLED": - case 4: - message.state = 4; - break; - } - if (object.submitTime != null) { - if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.vision.v1.BatchOperationMetadata.submitTime: object expected"); - message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.vision.v1.BatchOperationMetadata.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - return message; - }; - - /** - * Creates a plain object from a BatchOperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1.BatchOperationMetadata} message BatchOperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchOperationMetadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.submitTime = null; - object.endTime = null; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.vision.v1.BatchOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.vision.v1.BatchOperationMetadata.State[message.state] : message.state; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) - object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - return object; - }; - - /** - * Converts this BatchOperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @instance - * @returns {Object.} JSON object - */ - BatchOperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchOperationMetadata - * @function getTypeUrl - * @memberof google.cloud.vision.v1.BatchOperationMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.BatchOperationMetadata"; - }; - - /** - * State enum. - * @name google.cloud.vision.v1.BatchOperationMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} PROCESSING=1 PROCESSING value - * @property {number} SUCCESSFUL=2 SUCCESSFUL value - * @property {number} FAILED=3 FAILED value - * @property {number} CANCELLED=4 CANCELLED value - */ - BatchOperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PROCESSING"] = 1; - values[valuesById[2] = "SUCCESSFUL"] = 2; - values[valuesById[3] = "FAILED"] = 3; - values[valuesById[4] = "CANCELLED"] = 4; - return values; - })(); - - return BatchOperationMetadata; - })(); - - v1.ProductSetPurgeConfig = (function() { - - /** - * Properties of a ProductSetPurgeConfig. - * @memberof google.cloud.vision.v1 - * @interface IProductSetPurgeConfig - * @property {string|null} [productSetId] ProductSetPurgeConfig productSetId - */ - - /** - * Constructs a new ProductSetPurgeConfig. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a ProductSetPurgeConfig. - * @implements IProductSetPurgeConfig - * @constructor - * @param {google.cloud.vision.v1.IProductSetPurgeConfig=} [properties] Properties to set - */ - function ProductSetPurgeConfig(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]]; - } - - /** - * ProductSetPurgeConfig productSetId. - * @member {string} productSetId - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @instance - */ - ProductSetPurgeConfig.prototype.productSetId = ""; - - /** - * Creates a new ProductSetPurgeConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @static - * @param {google.cloud.vision.v1.IProductSetPurgeConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ProductSetPurgeConfig} ProductSetPurgeConfig instance - */ - ProductSetPurgeConfig.create = function create(properties) { - return new ProductSetPurgeConfig(properties); - }; - - /** - * Encodes the specified ProductSetPurgeConfig message. Does not implicitly {@link google.cloud.vision.v1.ProductSetPurgeConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @static - * @param {google.cloud.vision.v1.IProductSetPurgeConfig} message ProductSetPurgeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSetPurgeConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSetId != null && Object.hasOwnProperty.call(message, "productSetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.productSetId); - return writer; - }; - - /** - * Encodes the specified ProductSetPurgeConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ProductSetPurgeConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @static - * @param {google.cloud.vision.v1.IProductSetPurgeConfig} message ProductSetPurgeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSetPurgeConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSetPurgeConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @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.ProductSetPurgeConfig} ProductSetPurgeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSetPurgeConfig.decode = function decode(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.ProductSetPurgeConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.productSetId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSetPurgeConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ProductSetPurgeConfig} ProductSetPurgeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSetPurgeConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSetPurgeConfig message. - * @function verify - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSetPurgeConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - if (!$util.isString(message.productSetId)) - return "productSetId: string expected"; - return null; - }; - - /** - * Creates a ProductSetPurgeConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ProductSetPurgeConfig} ProductSetPurgeConfig - */ - ProductSetPurgeConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ProductSetPurgeConfig) - return object; - var message = new $root.google.cloud.vision.v1.ProductSetPurgeConfig(); - if (object.productSetId != null) - message.productSetId = String(object.productSetId); - return message; - }; - - /** - * Creates a plain object from a ProductSetPurgeConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @static - * @param {google.cloud.vision.v1.ProductSetPurgeConfig} message ProductSetPurgeConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSetPurgeConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.productSetId = ""; - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - object.productSetId = message.productSetId; - return object; - }; - - /** - * Converts this ProductSetPurgeConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @instance - * @returns {Object.} JSON object - */ - ProductSetPurgeConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSetPurgeConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1.ProductSetPurgeConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSetPurgeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.ProductSetPurgeConfig"; - }; - - return ProductSetPurgeConfig; - })(); - - v1.PurgeProductsRequest = (function() { - - /** - * Properties of a PurgeProductsRequest. - * @memberof google.cloud.vision.v1 - * @interface IPurgeProductsRequest - * @property {google.cloud.vision.v1.IProductSetPurgeConfig|null} [productSetPurgeConfig] PurgeProductsRequest productSetPurgeConfig - * @property {boolean|null} [deleteOrphanProducts] PurgeProductsRequest deleteOrphanProducts - * @property {string|null} [parent] PurgeProductsRequest parent - * @property {boolean|null} [force] PurgeProductsRequest force - */ - - /** - * Constructs a new PurgeProductsRequest. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a PurgeProductsRequest. - * @implements IPurgeProductsRequest - * @constructor - * @param {google.cloud.vision.v1.IPurgeProductsRequest=} [properties] Properties to set - */ - function PurgeProductsRequest(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]]; - } - - /** - * PurgeProductsRequest productSetPurgeConfig. - * @member {google.cloud.vision.v1.IProductSetPurgeConfig|null|undefined} productSetPurgeConfig - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @instance - */ - PurgeProductsRequest.prototype.productSetPurgeConfig = null; - - /** - * PurgeProductsRequest deleteOrphanProducts. - * @member {boolean|null|undefined} deleteOrphanProducts - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @instance - */ - PurgeProductsRequest.prototype.deleteOrphanProducts = null; - - /** - * PurgeProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @instance - */ - PurgeProductsRequest.prototype.parent = ""; - - /** - * PurgeProductsRequest force. - * @member {boolean} force - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @instance - */ - PurgeProductsRequest.prototype.force = false; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * PurgeProductsRequest target. - * @member {"productSetPurgeConfig"|"deleteOrphanProducts"|undefined} target - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @instance - */ - Object.defineProperty(PurgeProductsRequest.prototype, "target", { - get: $util.oneOfGetter($oneOfFields = ["productSetPurgeConfig", "deleteOrphanProducts"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PurgeProductsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @static - * @param {google.cloud.vision.v1.IPurgeProductsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.PurgeProductsRequest} PurgeProductsRequest instance - */ - PurgeProductsRequest.create = function create(properties) { - return new PurgeProductsRequest(properties); - }; - - /** - * Encodes the specified PurgeProductsRequest message. Does not implicitly {@link google.cloud.vision.v1.PurgeProductsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @static - * @param {google.cloud.vision.v1.IPurgeProductsRequest} message PurgeProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeProductsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.productSetPurgeConfig != null && Object.hasOwnProperty.call(message, "productSetPurgeConfig")) - $root.google.cloud.vision.v1.ProductSetPurgeConfig.encode(message.productSetPurgeConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.deleteOrphanProducts != null && Object.hasOwnProperty.call(message, "deleteOrphanProducts")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deleteOrphanProducts); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.force); - return writer; - }; - - /** - * Encodes the specified PurgeProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.PurgeProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @static - * @param {google.cloud.vision.v1.IPurgeProductsRequest} message PurgeProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PurgeProductsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @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.PurgeProductsRequest} PurgeProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeProductsRequest.decode = function decode(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.PurgeProductsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - message.productSetPurgeConfig = $root.google.cloud.vision.v1.ProductSetPurgeConfig.decode(reader, reader.uint32()); - break; - } - case 3: { - message.deleteOrphanProducts = reader.bool(); - break; - } - case 1: { - message.parent = reader.string(); - break; - } - case 4: { - message.force = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PurgeProductsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.PurgeProductsRequest} PurgeProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeProductsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PurgeProductsRequest message. - * @function verify - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PurgeProductsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.productSetPurgeConfig != null && message.hasOwnProperty("productSetPurgeConfig")) { - properties.target = 1; - { - var error = $root.google.cloud.vision.v1.ProductSetPurgeConfig.verify(message.productSetPurgeConfig); - if (error) - return "productSetPurgeConfig." + error; - } - } - if (message.deleteOrphanProducts != null && message.hasOwnProperty("deleteOrphanProducts")) { - if (properties.target === 1) - return "target: multiple values"; - properties.target = 1; - if (typeof message.deleteOrphanProducts !== "boolean") - return "deleteOrphanProducts: boolean expected"; - } - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; - return null; - }; - - /** - * Creates a PurgeProductsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.PurgeProductsRequest} PurgeProductsRequest - */ - PurgeProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.PurgeProductsRequest) - return object; - var message = new $root.google.cloud.vision.v1.PurgeProductsRequest(); - if (object.productSetPurgeConfig != null) { - if (typeof object.productSetPurgeConfig !== "object") - throw TypeError(".google.cloud.vision.v1.PurgeProductsRequest.productSetPurgeConfig: object expected"); - message.productSetPurgeConfig = $root.google.cloud.vision.v1.ProductSetPurgeConfig.fromObject(object.productSetPurgeConfig); - } - if (object.deleteOrphanProducts != null) - message.deleteOrphanProducts = Boolean(object.deleteOrphanProducts); - if (object.parent != null) - message.parent = String(object.parent); - if (object.force != null) - message.force = Boolean(object.force); - return message; - }; - - /** - * Creates a plain object from a PurgeProductsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @static - * @param {google.cloud.vision.v1.PurgeProductsRequest} message PurgeProductsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PurgeProductsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.force = false; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.productSetPurgeConfig != null && message.hasOwnProperty("productSetPurgeConfig")) { - object.productSetPurgeConfig = $root.google.cloud.vision.v1.ProductSetPurgeConfig.toObject(message.productSetPurgeConfig, options); - if (options.oneofs) - object.target = "productSetPurgeConfig"; - } - if (message.deleteOrphanProducts != null && message.hasOwnProperty("deleteOrphanProducts")) { - object.deleteOrphanProducts = message.deleteOrphanProducts; - if (options.oneofs) - object.target = "deleteOrphanProducts"; - } - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; - return object; - }; - - /** - * Converts this PurgeProductsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @instance - * @returns {Object.} JSON object - */ - PurgeProductsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PurgeProductsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1.PurgeProductsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PurgeProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.PurgeProductsRequest"; - }; - - return PurgeProductsRequest; - })(); - - v1.TextAnnotation = (function() { - - /** - * Properties of a TextAnnotation. - * @memberof google.cloud.vision.v1 - * @interface ITextAnnotation - * @property {Array.|null} [pages] TextAnnotation pages - * @property {string|null} [text] TextAnnotation text - */ - - /** - * Constructs a new TextAnnotation. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a TextAnnotation. - * @implements ITextAnnotation - * @constructor - * @param {google.cloud.vision.v1.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.v1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.pages = $util.emptyArray; - - /** - * TextAnnotation text. - * @member {string} text - * @memberof google.cloud.vision.v1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.text = ""; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.TextAnnotation - * @static - * @param {google.cloud.vision.v1.ITextAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.TextAnnotation} TextAnnotation instance - */ - TextAnnotation.create = function create(properties) { - return new TextAnnotation(properties); - }; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.TextAnnotation - * @static - * @param {google.cloud.vision.v1.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.v1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "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.v1.TextAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.TextAnnotation - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.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.v1.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.v1.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.v1.TextAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.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.v1.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.v1.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.v1.TextAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.TextAnnotation} TextAnnotation - */ - TextAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.TextAnnotation) - return object; - var message = new $root.google.cloud.vision.v1.TextAnnotation(); - if (object.pages) { - if (!Array.isArray(object.pages)) - throw TypeError(".google.cloud.vision.v1.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.v1.TextAnnotation.pages: object expected"); - message.pages[i] = $root.google.cloud.vision.v1.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.v1.TextAnnotation - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.TextAnnotation - * @instance - * @returns {Object.} JSON object - */ - TextAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1.TextAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.TextAnnotation"; - }; - - TextAnnotation.DetectedLanguage = (function() { - - /** - * Properties of a DetectedLanguage. - * @memberof google.cloud.vision.v1.TextAnnotation - * @interface IDetectedLanguage - * @property {string|null} [languageCode] DetectedLanguage languageCode - * @property {number|null} [confidence] DetectedLanguage confidence - */ - - /** - * Constructs a new DetectedLanguage. - * @memberof google.cloud.vision.v1.TextAnnotation - * @classdesc Represents a DetectedLanguage. - * @implements IDetectedLanguage - * @constructor - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.languageCode = ""; - - /** - * DetectedLanguage confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.confidence = 0; - - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set - * @returns {google.cloud.vision.v1.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.v1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1.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 && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1.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(); - }; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.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.v1.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.v1.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; - }; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.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()); - }; - - /** - * Verifies a DetectedLanguage message. - * @function verify - * @memberof google.cloud.vision.v1.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; - }; - - /** - * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.TextAnnotation.DetectedLanguage} DetectedLanguage - */ - DetectedLanguage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.TextAnnotation.DetectedLanguage) - return object; - var message = new $root.google.cloud.vision.v1.TextAnnotation.DetectedLanguage(); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1.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; - return object; - }; - - /** - * Converts this DetectedLanguage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @instance - * @returns {Object.} JSON object - */ - DetectedLanguage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DetectedLanguage - * @function getTypeUrl - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedLanguage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.TextAnnotation.DetectedLanguage"; - }; - - return DetectedLanguage; - })(); - - TextAnnotation.DetectedBreak = (function() { - - /** - * Properties of a DetectedBreak. - * @memberof google.cloud.vision.v1.TextAnnotation - * @interface IDetectedBreak - * @property {google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType|null} [type] DetectedBreak type - * @property {boolean|null} [isPrefix] DetectedBreak isPrefix - */ - - /** - * Constructs a new DetectedBreak. - * @memberof google.cloud.vision.v1.TextAnnotation - * @classdesc Represents a DetectedBreak. - * @implements IDetectedBreak - * @constructor - * @param {google.cloud.vision.v1.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]]; - } - - /** - * DetectedBreak type. - * @member {google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType} type - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.type = 0; - - /** - * DetectedBreak isPrefix. - * @member {boolean} isPrefix - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.isPrefix = false; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1.TextAnnotation.IDetectedBreak=} [properties] Properties to set - * @returns {google.cloud.vision.v1.TextAnnotation.DetectedBreak} DetectedBreak instance - */ - DetectedBreak.create = function create(properties) { - return new DetectedBreak(properties); - }; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1.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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.isPrefix != null && Object.hasOwnProperty.call(message, "isPrefix")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isPrefix); - return writer; - }; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1.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(); - }; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.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.v1.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.v1.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; - }; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedBreak - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.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.v1.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.v1.TextAnnotation.DetectedBreak - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.TextAnnotation.DetectedBreak} DetectedBreak - */ - DetectedBreak.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.TextAnnotation.DetectedBreak) - return object; - var message = new $root.google.cloud.vision.v1.TextAnnotation.DetectedBreak(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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.v1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.DetectedBreak.BreakType[message.type] === undefined ? message.type : $root.google.cloud.vision.v1.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.v1.TextAnnotation.DetectedBreak - * @instance - * @returns {Object.} JSON object - */ - DetectedBreak.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DetectedBreak - * @function getTypeUrl - * @memberof google.cloud.vision.v1.TextAnnotation.DetectedBreak - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.TextAnnotation.DetectedBreak"; - }; - - /** - * BreakType enum. - * @name google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType - * @enum {number} - * @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.v1.TextAnnotation - * @interface ITextProperty - * @property {Array.|null} [detectedLanguages] TextProperty detectedLanguages - * @property {google.cloud.vision.v1.TextAnnotation.IDetectedBreak|null} [detectedBreak] TextProperty detectedBreak - */ - - /** - * Constructs a new TextProperty. - * @memberof google.cloud.vision.v1.TextAnnotation - * @classdesc Represents a TextProperty. - * @implements ITextProperty - * @constructor - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedLanguages = $util.emptyArray; - - /** - * TextProperty detectedBreak. - * @member {google.cloud.vision.v1.TextAnnotation.IDetectedBreak|null|undefined} detectedBreak - * @memberof google.cloud.vision.v1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedBreak = null; - - /** - * Creates a new TextProperty instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1.TextAnnotation.ITextProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.detectedBreak != null && Object.hasOwnProperty.call(message, "detectedBreak")) - $root.google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.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.v1.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.v1.TextAnnotation.DetectedLanguage.decode(reader, reader.uint32())); - break; - } - case 2: { - message.detectedBreak = $root.google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.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.v1.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.v1.TextAnnotation.DetectedLanguage.verify(message.detectedLanguages[i]); - if (error) - return "detectedLanguages." + error; - } - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { - var error = $root.google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.TextAnnotation.TextProperty} TextProperty - */ - TextProperty.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.TextAnnotation.TextProperty) - return object; - var message = new $root.google.cloud.vision.v1.TextAnnotation.TextProperty(); - if (object.detectedLanguages) { - if (!Array.isArray(object.detectedLanguages)) - throw TypeError(".google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty.detectedLanguages: object expected"); - message.detectedLanguages[i] = $root.google.cloud.vision.v1.TextAnnotation.DetectedLanguage.fromObject(object.detectedLanguages[i]); - } - } - if (object.detectedBreak != null) { - if (typeof object.detectedBreak !== "object") - throw TypeError(".google.cloud.vision.v1.TextAnnotation.TextProperty.detectedBreak: object expected"); - message.detectedBreak = $root.google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.DetectedLanguage.toObject(message.detectedLanguages[j], options); - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) - object.detectedBreak = $root.google.cloud.vision.v1.TextAnnotation.DetectedBreak.toObject(message.detectedBreak, options); - return object; - }; - - /** - * Converts this TextProperty to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.TextAnnotation.TextProperty - * @instance - * @returns {Object.} JSON object - */ - TextProperty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextProperty - * @function getTypeUrl - * @memberof google.cloud.vision.v1.TextAnnotation.TextProperty - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextProperty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.TextAnnotation.TextProperty"; - }; - - return TextProperty; - })(); - - return TextAnnotation; - })(); - - v1.Page = (function() { - - /** - * Properties of a Page. - * @memberof google.cloud.vision.v1 - * @interface IPage - * @property {google.cloud.vision.v1.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.v1 - * @classdesc Represents a Page. - * @implements IPage - * @constructor - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1.Page - * @instance - */ - Page.prototype.property = null; - - /** - * Page width. - * @member {number} width - * @memberof google.cloud.vision.v1.Page - * @instance - */ - Page.prototype.width = 0; - - /** - * Page height. - * @member {number} height - * @memberof google.cloud.vision.v1.Page - * @instance - */ - Page.prototype.height = 0; - - /** - * Page blocks. - * @member {Array.} blocks - * @memberof google.cloud.vision.v1.Page - * @instance - */ - Page.prototype.blocks = $util.emptyArray; - - /** - * Page confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1.Page - * @instance - */ - Page.prototype.confidence = 0; - - /** - * Creates a new Page instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Page - * @static - * @param {google.cloud.vision.v1.IPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Page} Page instance - */ - Page.create = function create(properties) { - return new Page(properties); - }; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1.Page.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Page - * @static - * @param {google.cloud.vision.v1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.width); - if (message.height != null && Object.hasOwnProperty.call(message, "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.v1.Block.encode(message.blocks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1.Page.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.Page - * @static - * @param {google.cloud.vision.v1.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(); - }; - - /** - * Decodes a Page message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.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.v1.Page} Page - * @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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.Page(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1.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.v1.Block.decode(reader, reader.uint32())); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.Page - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Page} Page - * @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) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Page message. - * @function verify - * @memberof google.cloud.vision.v1.Page - * @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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + 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.v1.Block.verify(message.blocks[i]); - if (error) - return "blocks." + 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. - * @function fromObject - * @memberof google.cloud.vision.v1.Page - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Page} Page - */ - Page.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Page) - return object; - var message = new $root.google.cloud.vision.v1.Page(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1.Page.property: object expected"); - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.fromObject(object.property); - } - 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.v1.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.v1.Page.blocks: object expected"); - message.blocks[i] = $root.google.cloud.vision.v1.Block.fromObject(object.blocks[i]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1.Page - * @static - * @param {google.cloud.vision.v1.Page} message Page - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.width = 0; - object.height = 0; - object.confidence = 0; - } - if (message.property != null && message.hasOwnProperty("property")) - object.property = $root.google.cloud.vision.v1.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.v1.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 Page to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.Page - * @instance - * @returns {Object.} JSON object - */ - Page.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Page - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Page - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Page"; - }; - - return Page; - })(); - - v1.Block = (function() { - - /** - * Properties of a Block. - * @memberof google.cloud.vision.v1 - * @interface IBlock - * @property {google.cloud.vision.v1.TextAnnotation.ITextProperty|null} [property] Block property - * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingBox] Block boundingBox - * @property {Array.|null} [paragraphs] Block paragraphs - * @property {google.cloud.vision.v1.Block.BlockType|null} [blockType] Block blockType - * @property {number|null} [confidence] Block confidence - */ - - /** - * Constructs a new Block. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a Block. - * @implements IBlock - * @constructor - * @param {google.cloud.vision.v1.IBlock=} [properties] Properties to set - */ - function Block(properties) { - this.paragraphs = []; - 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]]; - } - - /** - * Block property. - * @member {google.cloud.vision.v1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1.Block - * @instance - */ - Block.prototype.property = null; - - /** - * Block boundingBox. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1.Block - * @instance - */ - Block.prototype.boundingBox = null; - - /** - * Block paragraphs. - * @member {Array.} paragraphs - * @memberof google.cloud.vision.v1.Block - * @instance - */ - Block.prototype.paragraphs = $util.emptyArray; - - /** - * Block blockType. - * @member {google.cloud.vision.v1.Block.BlockType} blockType - * @memberof google.cloud.vision.v1.Block - * @instance - */ - Block.prototype.blockType = 0; - - /** - * Block confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1.Block - * @instance - */ - Block.prototype.confidence = 0; - - /** - * Creates a new Block instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Block - * @static - * @param {google.cloud.vision.v1.IBlock=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Block} Block instance - */ - Block.create = function create(properties) { - return new Block(properties); - }; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1.Block.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Block - * @static - * @param {google.cloud.vision.v1.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.property != null && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1.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.v1.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.blockType != null && Object.hasOwnProperty.call(message, "blockType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.blockType); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Block.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.Block - * @static - * @param {google.cloud.vision.v1.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Block message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.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.v1.Block} Block - * @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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.Block(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.vision.v1.Paragraph.decode(reader, reader.uint32())); - break; - } - case 4: { - message.blockType = reader.int32(); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.Block - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Block} Block - * @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) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Block message. - * @function verify - * @memberof google.cloud.vision.v1.Block - * @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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1.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.v1.Paragraph.verify(message.paragraphs[i]); - if (error) - return "paragraphs." + 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 Block message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.Block - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Block} Block - */ - Block.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Block) - return object; - var message = new $root.google.cloud.vision.v1.Block(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1.Block.property: object expected"); - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1.Block.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.paragraphs) { - if (!Array.isArray(object.paragraphs)) - throw TypeError(".google.cloud.vision.v1.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.v1.Block.paragraphs: object expected"); - message.paragraphs[i] = $root.google.cloud.vision.v1.Paragraph.fromObject(object.paragraphs[i]); - } - } - switch (object.blockType) { - default: - if (typeof object.blockType === "number") { - message.blockType = object.blockType; - break; - } - break; - 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 Block message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.Block - * @static - * @param {google.cloud.vision.v1.Block} message Block - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Block.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.v1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1.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.v1.Paragraph.toObject(message.paragraphs[j], options); - } - if (message.blockType != null && message.hasOwnProperty("blockType")) - object.blockType = options.enums === String ? $root.google.cloud.vision.v1.Block.BlockType[message.blockType] === undefined ? message.blockType : $root.google.cloud.vision.v1.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 Block to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.Block - * @instance - * @returns {Object.} JSON object - */ - Block.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Block - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Block - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Block"; - }; - - /** - * BlockType enum. - * @name google.cloud.vision.v1.Block.BlockType - * @enum {number} - * @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; - })(); - - return Block; - })(); - - v1.Paragraph = (function() { - - /** - * Properties of a Paragraph. - * @memberof google.cloud.vision.v1 - * @interface IParagraph - * @property {google.cloud.vision.v1.TextAnnotation.ITextProperty|null} [property] Paragraph property - * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingBox] Paragraph boundingBox - * @property {Array.|null} [words] Paragraph words - * @property {number|null} [confidence] Paragraph confidence - */ - - /** - * Constructs a new Paragraph. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a Paragraph. - * @implements IParagraph - * @constructor - * @param {google.cloud.vision.v1.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]]; - } - - /** - * Paragraph property. - * @member {google.cloud.vision.v1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1.Paragraph - * @instance - */ - Paragraph.prototype.property = null; - - /** - * Paragraph boundingBox. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1.Paragraph - * @instance - */ - Paragraph.prototype.boundingBox = null; - - /** - * Paragraph words. - * @member {Array.} words - * @memberof google.cloud.vision.v1.Paragraph - * @instance - */ - Paragraph.prototype.words = $util.emptyArray; - - /** - * Paragraph confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1.Paragraph - * @instance - */ - Paragraph.prototype.confidence = 0; - - /** - * Creates a new Paragraph instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Paragraph - * @static - * @param {google.cloud.vision.v1.IParagraph=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Paragraph} Paragraph instance - */ - Paragraph.create = function create(properties) { - return new Paragraph(properties); - }; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1.Paragraph.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Paragraph - * @static - * @param {google.cloud.vision.v1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1.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.v1.Word.encode(message.words[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1.Paragraph.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.Paragraph - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.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.v1.Paragraph(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.words && message.words.length)) - message.words = []; - message.words.push($root.google.cloud.vision.v1.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.v1.Paragraph - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.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.v1.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.v1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1.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.v1.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.v1.Paragraph - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Paragraph} Paragraph - */ - Paragraph.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Paragraph) - return object; - var message = new $root.google.cloud.vision.v1.Paragraph(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1.Paragraph.property: object expected"); - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1.Paragraph.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.words) { - if (!Array.isArray(object.words)) - throw TypeError(".google.cloud.vision.v1.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.v1.Paragraph.words: object expected"); - message.words[i] = $root.google.cloud.vision.v1.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.v1.Paragraph - * @static - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1.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.v1.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.v1.Paragraph - * @instance - * @returns {Object.} JSON object - */ - Paragraph.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Paragraph - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Paragraph - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Paragraph"; - }; - - return Paragraph; - })(); - - v1.Word = (function() { - - /** - * Properties of a Word. - * @memberof google.cloud.vision.v1 - * @interface IWord - * @property {google.cloud.vision.v1.TextAnnotation.ITextProperty|null} [property] Word property - * @property {google.cloud.vision.v1.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.v1 - * @classdesc Represents a Word. - * @implements IWord - * @constructor - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1.Word - * @instance - */ - Word.prototype.property = null; - - /** - * Word boundingBox. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1.Word - * @instance - */ - Word.prototype.boundingBox = null; - - /** - * Word symbols. - * @member {Array.} symbols - * @memberof google.cloud.vision.v1.Word - * @instance - */ - Word.prototype.symbols = $util.emptyArray; - - /** - * Word confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1.Word - * @instance - */ - Word.prototype.confidence = 0; - - /** - * Creates a new Word instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Word - * @static - * @param {google.cloud.vision.v1.IWord=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Word} Word instance - */ - Word.create = function create(properties) { - return new Word(properties); - }; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1.Word.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Word - * @static - * @param {google.cloud.vision.v1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1.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.v1.Symbol.encode(message.symbols[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1.Word.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.Word - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.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.v1.Word(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.symbols && message.symbols.length)) - message.symbols = []; - message.symbols.push($root.google.cloud.vision.v1.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.v1.Word - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.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.v1.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.v1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1.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.v1.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.v1.Word - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Word} Word - */ - Word.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Word) - return object; - var message = new $root.google.cloud.vision.v1.Word(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1.Word.property: object expected"); - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1.Word.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.symbols) { - if (!Array.isArray(object.symbols)) - throw TypeError(".google.cloud.vision.v1.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.v1.Word.symbols: object expected"); - message.symbols[i] = $root.google.cloud.vision.v1.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.v1.Word - * @static - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1.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.v1.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.v1.Word - * @instance - * @returns {Object.} JSON object - */ - Word.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Word - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Word - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Word.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Word"; - }; - - return Word; - })(); - - v1.Symbol = (function() { - - /** - * Properties of a Symbol. - * @memberof google.cloud.vision.v1 - * @interface ISymbol - * @property {google.cloud.vision.v1.TextAnnotation.ITextProperty|null} [property] Symbol property - * @property {google.cloud.vision.v1.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.v1 - * @classdesc Represents a Symbol. - * @implements ISymbol - * @constructor - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1.Symbol - * @instance - */ - Symbol.prototype.property = null; - - /** - * Symbol boundingBox. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1.Symbol - * @instance - */ - Symbol.prototype.boundingBox = null; - - /** - * Symbol text. - * @member {string} text - * @memberof google.cloud.vision.v1.Symbol - * @instance - */ - Symbol.prototype.text = ""; - - /** - * Symbol confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1.Symbol - * @instance - */ - Symbol.prototype.confidence = 0; - - /** - * Creates a new Symbol instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.Symbol - * @static - * @param {google.cloud.vision.v1.ISymbol=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Symbol} Symbol instance - */ - Symbol.create = function create(properties) { - return new Symbol(properties); - }; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1.Symbol.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.Symbol - * @static - * @param {google.cloud.vision.v1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "text")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.text); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1.Symbol.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.Symbol - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.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.v1.Symbol(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1.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.v1.Symbol - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.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.v1.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.v1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1.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.v1.Symbol - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Symbol} Symbol - */ - Symbol.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Symbol) - return object; - var message = new $root.google.cloud.vision.v1.Symbol(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1.Symbol.property: object expected"); - message.property = $root.google.cloud.vision.v1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1.Symbol.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1.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.v1.Symbol - * @static - * @param {google.cloud.vision.v1.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.v1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1.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.v1.Symbol - * @instance - * @returns {Object.} JSON object - */ - Symbol.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Symbol - * @function getTypeUrl - * @memberof google.cloud.vision.v1.Symbol - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Symbol.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.Symbol"; - }; - - return Symbol; - })(); - - v1.WebDetection = (function() { - - /** - * Properties of a WebDetection. - * @memberof google.cloud.vision.v1 - * @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.v1 - * @classdesc Represents a WebDetection. - * @implements IWebDetection - * @constructor - * @param {google.cloud.vision.v1.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.v1.WebDetection - * @instance - */ - WebDetection.prototype.webEntities = $util.emptyArray; - - /** - * WebDetection fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1.WebDetection - * @instance - */ - WebDetection.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebDetection partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1.WebDetection - * @instance - */ - WebDetection.prototype.partialMatchingImages = $util.emptyArray; - - /** - * WebDetection pagesWithMatchingImages. - * @member {Array.} pagesWithMatchingImages - * @memberof google.cloud.vision.v1.WebDetection - * @instance - */ - WebDetection.prototype.pagesWithMatchingImages = $util.emptyArray; - - /** - * WebDetection visuallySimilarImages. - * @member {Array.} visuallySimilarImages - * @memberof google.cloud.vision.v1.WebDetection - * @instance - */ - WebDetection.prototype.visuallySimilarImages = $util.emptyArray; - - /** - * WebDetection bestGuessLabels. - * @member {Array.} bestGuessLabels - * @memberof google.cloud.vision.v1.WebDetection - * @instance - */ - WebDetection.prototype.bestGuessLabels = $util.emptyArray; - - /** - * Creates a new WebDetection instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.WebDetection - * @static - * @param {google.cloud.vision.v1.IWebDetection=} [properties] Properties to set - * @returns {google.cloud.vision.v1.WebDetection} WebDetection instance - */ - WebDetection.create = function create(properties) { - return new WebDetection(properties); - }; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.WebDetection - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.WebDetection.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.WebDetection - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.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.v1.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.v1.WebDetection.WebEntity.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 4: { - if (!(message.pagesWithMatchingImages && message.pagesWithMatchingImages.length)) - message.pagesWithMatchingImages = []; - message.pagesWithMatchingImages.push($root.google.cloud.vision.v1.WebDetection.WebPage.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.visuallySimilarImages && message.visuallySimilarImages.length)) - message.visuallySimilarImages = []; - message.visuallySimilarImages.push($root.google.cloud.vision.v1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 8: { - if (!(message.bestGuessLabels && message.bestGuessLabels.length)) - message.bestGuessLabels = []; - message.bestGuessLabels.push($root.google.cloud.vision.v1.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.v1.WebDetection - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.WebDetection - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.WebDetection} WebDetection - */ - WebDetection.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.WebDetection) - return object; - var message = new $root.google.cloud.vision.v1.WebDetection(); - if (object.webEntities) { - if (!Array.isArray(object.webEntities)) - throw TypeError(".google.cloud.vision.v1.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.v1.WebDetection.webEntities: object expected"); - message.webEntities[i] = $root.google.cloud.vision.v1.WebDetection.WebEntity.fromObject(object.webEntities[i]); - } - } - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1.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.v1.WebDetection.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1.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.v1.WebDetection.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - if (object.pagesWithMatchingImages) { - if (!Array.isArray(object.pagesWithMatchingImages)) - throw TypeError(".google.cloud.vision.v1.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.v1.WebDetection.pagesWithMatchingImages: object expected"); - message.pagesWithMatchingImages[i] = $root.google.cloud.vision.v1.WebDetection.WebPage.fromObject(object.pagesWithMatchingImages[i]); - } - } - if (object.visuallySimilarImages) { - if (!Array.isArray(object.visuallySimilarImages)) - throw TypeError(".google.cloud.vision.v1.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.v1.WebDetection.visuallySimilarImages: object expected"); - message.visuallySimilarImages[i] = $root.google.cloud.vision.v1.WebDetection.WebImage.fromObject(object.visuallySimilarImages[i]); - } - } - if (object.bestGuessLabels) { - if (!Array.isArray(object.bestGuessLabels)) - throw TypeError(".google.cloud.vision.v1.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.v1.WebDetection.bestGuessLabels: object expected"); - message.bestGuessLabels[i] = $root.google.cloud.vision.v1.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.v1.WebDetection - * @static - * @param {google.cloud.vision.v1.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.v1.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.v1.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.v1.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.v1.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.v1.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.v1.WebDetection.WebLabel.toObject(message.bestGuessLabels[j], options); - } - return object; - }; - - /** - * Converts this WebDetection to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.WebDetection - * @instance - * @returns {Object.} JSON object - */ - WebDetection.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetection - * @function getTypeUrl - * @memberof google.cloud.vision.v1.WebDetection - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.WebDetection"; - }; - - WebDetection.WebEntity = (function() { - - /** - * Properties of a WebEntity. - * @memberof google.cloud.vision.v1.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.v1.WebDetection - * @classdesc Represents a WebEntity. - * @implements IWebEntity - * @constructor - * @param {google.cloud.vision.v1.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.v1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.entityId = ""; - - /** - * WebEntity score. - * @member {number} score - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.score = 0; - - /** - * WebEntity description. - * @member {string} description - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.description = ""; - - /** - * Creates a new WebEntity instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebEntity=} [properties] Properties to set - * @returns {google.cloud.vision.v1.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.v1.WebDetection.WebEntity.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1.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 && Object.hasOwnProperty.call(message, "entityId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.entityId); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - return writer; - }; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebEntity.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebEntity} message WebEntity message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebEntity.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @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.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decode = function decode(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.WebDetection.WebEntity(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.entityId = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.description = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebEntity message. - * @function verify - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebEntity.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.entityId != null && message.hasOwnProperty("entityId")) - if (!$util.isString(message.entityId)) - return "entityId: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - return null; - }; - - /** - * Creates a WebEntity message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.WebDetection.WebEntity} WebEntity - */ - WebEntity.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.WebDetection.WebEntity) - return object; - var message = new $root.google.cloud.vision.v1.WebDetection.WebEntity(); - if (object.entityId != null) - message.entityId = String(object.entityId); - if (object.score != null) - message.score = Number(object.score); - if (object.description != null) - message.description = String(object.description); - return message; - }; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1.WebDetection.WebEntity} message WebEntity - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebEntity.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.entityId = ""; - object.score = 0; - object.description = ""; - } - if (message.entityId != null && message.hasOwnProperty("entityId")) - object.entityId = message.entityId; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - return object; - }; - - /** - * Converts this WebEntity to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @instance - * @returns {Object.} JSON object - */ - WebEntity.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebEntity - * @function getTypeUrl - * @memberof google.cloud.vision.v1.WebDetection.WebEntity - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebEntity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.WebDetection.WebEntity"; - }; - - return WebEntity; - })(); - - WebDetection.WebImage = (function() { - - /** - * Properties of a WebImage. - * @memberof google.cloud.vision.v1.WebDetection - * @interface IWebImage - * @property {string|null} [url] WebImage url - * @property {number|null} [score] WebImage score - */ - - /** - * Constructs a new WebImage. - * @memberof google.cloud.vision.v1.WebDetection - * @classdesc Represents a WebImage. - * @implements IWebImage - * @constructor - * @param {google.cloud.vision.v1.WebDetection.IWebImage=} [properties] Properties to set - */ - function WebImage(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]]; - } - - /** - * WebImage url. - * @member {string} url - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.url = ""; - - /** - * WebImage score. - * @member {number} score - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.score = 0; - - /** - * Creates a new WebImage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1.WebDetection.WebImage} WebImage instance - */ - WebImage.create = function create(properties) { - return new WebImage(properties); - }; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebImage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - return writer; - }; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebImage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @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.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decode = function decode(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.WebDetection.WebImage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebImage message. - * @function verify - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebImage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - return null; - }; - - /** - * Creates a WebImage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.WebDetection.WebImage} WebImage - */ - WebImage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.WebDetection.WebImage) - return object; - var message = new $root.google.cloud.vision.v1.WebDetection.WebImage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - return message; - }; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1.WebDetection.WebImage} message WebImage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebImage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.url = ""; - object.score = 0; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - return object; - }; - - /** - * Converts this WebImage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @instance - * @returns {Object.} JSON object - */ - WebImage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebImage - * @function getTypeUrl - * @memberof google.cloud.vision.v1.WebDetection.WebImage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebImage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.WebDetection.WebImage"; - }; - - return WebImage; - })(); - - WebDetection.WebPage = (function() { - - /** - * Properties of a WebPage. - * @memberof google.cloud.vision.v1.WebDetection - * @interface IWebPage - * @property {string|null} [url] WebPage url - * @property {number|null} [score] WebPage score - * @property {string|null} [pageTitle] WebPage pageTitle - * @property {Array.|null} [fullMatchingImages] WebPage fullMatchingImages - * @property {Array.|null} [partialMatchingImages] WebPage partialMatchingImages - */ - - /** - * Constructs a new WebPage. - * @memberof google.cloud.vision.v1.WebDetection - * @classdesc Represents a WebPage. - * @implements IWebPage - * @constructor - * @param {google.cloud.vision.v1.WebDetection.IWebPage=} [properties] Properties to set - */ - function WebPage(properties) { - this.fullMatchingImages = []; - this.partialMatchingImages = []; - 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]]; - } - - /** - * WebPage url. - * @member {string} url - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.url = ""; - - /** - * WebPage score. - * @member {number} score - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.score = 0; - - /** - * WebPage pageTitle. - * @member {string} pageTitle - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.pageTitle = ""; - - /** - * WebPage fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebPage partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.partialMatchingImages = $util.emptyArray; - - /** - * Creates a new WebPage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1.WebDetection.WebPage} WebPage instance - */ - WebPage.create = function create(properties) { - return new WebPage(properties); - }; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebPage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pageTitle != null && Object.hasOwnProperty.call(message, "pageTitle")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageTitle); - if (message.fullMatchingImages != null && message.fullMatchingImages.length) - for (var i = 0; i < message.fullMatchingImages.length; ++i) - $root.google.cloud.vision.v1.WebDetection.WebImage.encode(message.fullMatchingImages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.partialMatchingImages != null && message.partialMatchingImages.length) - for (var i = 0; i < message.partialMatchingImages.length; ++i) - $root.google.cloud.vision.v1.WebDetection.WebImage.encode(message.partialMatchingImages[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebPage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @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.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decode = function decode(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.WebDetection.WebPage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.pageTitle = reader.string(); - break; - } - case 4: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebPage message. - * @function verify - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebPage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - if (!$util.isString(message.pageTitle)) - return "pageTitle: string expected"; - 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.v1.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.v1.WebDetection.WebImage.verify(message.partialMatchingImages[i]); - if (error) - return "partialMatchingImages." + error; - } - } - return null; - }; - - /** - * Creates a WebPage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.WebDetection.WebPage} WebPage - */ - WebPage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.WebDetection.WebPage) - return object; - var message = new $root.google.cloud.vision.v1.WebDetection.WebPage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - if (object.pageTitle != null) - message.pageTitle = String(object.pageTitle); - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1.WebDetection.WebPage.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.v1.WebDetection.WebPage.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1.WebDetection.WebPage.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.v1.WebDetection.WebPage.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1.WebDetection.WebPage} message WebPage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebPage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.fullMatchingImages = []; - object.partialMatchingImages = []; - } - if (options.defaults) { - object.url = ""; - object.score = 0; - object.pageTitle = ""; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - object.pageTitle = message.pageTitle; - if (message.fullMatchingImages && message.fullMatchingImages.length) { - object.fullMatchingImages = []; - for (var j = 0; j < message.fullMatchingImages.length; ++j) - object.fullMatchingImages[j] = $root.google.cloud.vision.v1.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.v1.WebDetection.WebImage.toObject(message.partialMatchingImages[j], options); - } - return object; - }; - - /** - * Converts this WebPage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @instance - * @returns {Object.} JSON object - */ - WebPage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebPage - * @function getTypeUrl - * @memberof google.cloud.vision.v1.WebDetection.WebPage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebPage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.WebDetection.WebPage"; - }; - - return WebPage; - })(); - - WebDetection.WebLabel = (function() { - - /** - * Properties of a WebLabel. - * @memberof google.cloud.vision.v1.WebDetection - * @interface IWebLabel - * @property {string|null} [label] WebLabel label - * @property {string|null} [languageCode] WebLabel languageCode - */ - - /** - * Constructs a new WebLabel. - * @memberof google.cloud.vision.v1.WebDetection - * @classdesc Represents a WebLabel. - * @implements IWebLabel - * @constructor - * @param {google.cloud.vision.v1.WebDetection.IWebLabel=} [properties] Properties to set - */ - function WebLabel(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]]; - } - - /** - * WebLabel label. - * @member {string} label - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.label = ""; - - /** - * WebLabel languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.languageCode = ""; - - /** - * Creates a new WebLabel instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebLabel=} [properties] Properties to set - * @returns {google.cloud.vision.v1.WebDetection.WebLabel} WebLabel instance - */ - WebLabel.create = function create(properties) { - return new WebLabel(properties); - }; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebLabel.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.label); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - return writer; - }; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetection.WebLabel.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @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.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decode = function decode(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.WebDetection.WebLabel(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.label = reader.string(); - break; - } - case 2: { - message.languageCode = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebLabel message. - * @function verify - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebLabel.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.label != null && message.hasOwnProperty("label")) - if (!$util.isString(message.label)) - return "label: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - return null; - }; - - /** - * Creates a WebLabel message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.WebDetection.WebLabel} WebLabel - */ - WebLabel.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.WebDetection.WebLabel) - return object; - var message = new $root.google.cloud.vision.v1.WebDetection.WebLabel(); - if (object.label != null) - message.label = String(object.label); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - return message; - }; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1.WebDetection.WebLabel} message WebLabel - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebLabel.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - 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; - }; - - /** - * Converts this WebLabel to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @instance - * @returns {Object.} JSON object - */ - WebLabel.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebLabel - * @function getTypeUrl - * @memberof google.cloud.vision.v1.WebDetection.WebLabel - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebLabel.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1.WebDetection.WebLabel"; - }; - - return WebLabel; - })(); - - return WebDetection; - })(); - - return v1; - })(); - - vision.v1p1beta1 = (function() { - - /** - * Namespace v1p1beta1. - * @memberof google.cloud.vision - * @namespace - */ - var v1p1beta1 = {}; - - v1p1beta1.Vertex = (function() { - - /** - * Properties of a Vertex. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y - */ - - /** - * Constructs a new Vertex. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Vertex. - * @implements IVertex - * @constructor - * @param {google.cloud.vision.v1p1beta1.IVertex=} [properties] Properties to set - */ - 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]]; - } - - /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p1beta1.Vertex - * @instance - */ - Vertex.prototype.x = 0; - - /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p1beta1.Vertex - * @instance - */ - Vertex.prototype.y = 0; - - /** - * Creates a new Vertex instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.Vertex - * @static - * @param {google.cloud.vision.v1p1beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex instance - */ - Vertex.create = function create(properties) { - return new Vertex(properties); - }; - - /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Vertex - * @static - * @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 - */ - Vertex.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); - return writer; - }; - - /** - * 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.Vertex - * @static - * @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 - */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Vertex message from the specified reader or buffer. - * @function decode - * @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.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.v1p1beta1.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; - }; - - /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Vertex - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Vertex.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Vertex message. - * @function verify - * @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 - */ - 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; - }; - - /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Vertex - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex - */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Vertex) - 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; - return message; - }; - - /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Vertex - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.Vertex - * @instance - * @returns {Object.} JSON object - */ - Vertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Vertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Vertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Vertex"; - }; - - return Vertex; - })(); - - v1p1beta1.BoundingPoly = (function() { - - /** - * Properties of a BoundingPoly. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - */ - - /** - * Constructs a new BoundingPoly. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly - * @constructor - * @param {google.cloud.vision.v1p1beta1.IBoundingPoly=} [properties] Properties to set - */ - function BoundingPoly(properties) { - this.vertices = []; - 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]]; - } - - /** - * BoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly - * @instance - */ - BoundingPoly.prototype.vertices = $util.emptyArray; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly - * @static - * @param {google.cloud.vision.v1p1beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly instance - */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); - }; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly - * @static - * @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 - */ - BoundingPoly.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(); - return writer; - }; - - /** - * 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.BoundingPoly - * @static - * @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 - */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @function decode - * @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.BoundingPoly} BoundingPoly - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BoundingPoly message. - * @function verify - * @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 - */ - BoundingPoly.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 (error) - return "vertices." + error; - } - } - return null; - }; - - /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly - */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.BoundingPoly) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly - * @static - * @param {google.cloud.vision.v1p1beta1.BoundingPoly} message BoundingPoly - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoundingPoly.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); - } - return object; - }; - - /** - * Converts this BoundingPoly to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly - * @instance - * @returns {Object.} JSON object - */ - BoundingPoly.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BoundingPoly - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.BoundingPoly"; - }; - - return BoundingPoly; - })(); - - v1p1beta1.Position = (function() { - - /** - * Properties of a Position. - * @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 - */ - - /** - * Constructs a new Position. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Position. - * @implements IPosition - * @constructor - * @param {google.cloud.vision.v1p1beta1.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]]; - } - - /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1p1beta1.Position - * @instance - */ - Position.prototype.x = 0; - - /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1p1beta1.Position - * @instance - */ - Position.prototype.y = 0; - - /** - * 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.Position - * @static - * @param {google.cloud.vision.v1p1beta1.IPosition=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Position} Position instance - */ - Position.create = function create(properties) { - return new Position(properties); - }; - - /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Position - * @static - * @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 - */ - Position.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && Object.hasOwnProperty.call(message, "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.v1p1beta1.Position.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Position - * @static - * @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 - */ - 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.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.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.v1p1beta1.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; - }; - - /** - * Decodes a Position message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Position - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p1beta1.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.v1p1beta1.Position - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Position} Position - */ - Position.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Position) - 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); - return message; - }; - - /** - * Creates a plain object from a Position message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Position - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.Position - * @instance - * @returns {Object.} JSON object - */ - Position.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Position - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Position - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Position.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Position"; - }; - - return Position; - })(); - - 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() { - - /** - * 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 - */ - - /** - * 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 - */ - 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.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 - * @instance - */ - Feature.prototype.maxResults = 0; - - /** - * Feature model. - * @member {string} model - * @memberof google.cloud.vision.v1p1beta1.Feature - * @instance - */ - Feature.prototype.model = ""; - - /** - * Creates a new Feature instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.Feature - * @static - * @param {google.cloud.vision.v1p1beta1.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Feature} Feature instance - */ - Feature.create = function create(properties) { - return new Feature(properties); - }; - - /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Feature.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Feature - * @static - * @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 - */ - Feature.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && Object.hasOwnProperty.call(message, "model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); - return writer; - }; - - /** - * 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.Feature - * @static - * @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 - */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Feature message from the specified reader or buffer. - * @function decode - * @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.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.v1p1beta1.Feature(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type = reader.int32(); - break; - } - case 2: { - message.maxResults = reader.int32(); - break; - } - case 3: { - message.model = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Feature - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p1beta1.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: - 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 Feature message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Feature - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Feature} Feature - */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Feature) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.Feature(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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 Feature message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Feature - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.Feature.Type[message.type] === undefined ? message.type : $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 Feature to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Feature - * @instance - * @returns {Object.} JSON object - */ - Feature.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Feature - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Feature - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Feature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Feature"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p1beta1.Feature.Type - * @enum {number} - * @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; - })(); - - v1p1beta1.ImageSource = (function() { - - /** - * Properties of an ImageSource. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri - */ - - /** - * Constructs a new ImageSource. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an ImageSource. - * @implements IImageSource - * @constructor - * @param {google.cloud.vision.v1p1beta1.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]]; - } - - /** - * 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 - * @instance - */ - ImageSource.prototype.imageUri = ""; - - /** - * Creates a new ImageSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.ImageSource - * @static - * @param {google.cloud.vision.v1p1beta1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource instance - */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); - }; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.ImageSource - * @static - * @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 - */ - ImageSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsImageUri != null && Object.hasOwnProperty.call(message, "gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); - return writer; - }; - - /** - * 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.ImageSource - * @static - * @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 - */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer. - * @function decode - * @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.ImageSource} ImageSource - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsImageUri = reader.string(); - break; - } - case 2: { - message.imageUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageSource message. - * @function verify - * @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 - */ - ImageSource.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"; - return null; - }; - - /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.ImageSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource - */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageSource) - 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); - return message; - }; - - /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.ImageSource - * @static - * @param {google.cloud.vision.v1p1beta1.ImageSource} message ImageSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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 ImageSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.ImageSource - * @instance - * @returns {Object.} JSON object - */ - ImageSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.ImageSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.ImageSource"; - }; - - return ImageSource; - })(); - - v1p1beta1.Image = (function() { - - /** - * Properties of an Image. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1p1beta1.IImageSource|null} [source] Image source - */ - - /** - * Constructs a new Image. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an Image. - * @implements IImage - * @constructor - * @param {google.cloud.vision.v1p1beta1.IImage=} [properties] Properties to set - */ - function Image(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]]; - } - - /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1p1beta1.Image - * @instance - */ - Image.prototype.content = $util.newBuffer([]); - - /** - * Image source. - * @member {google.cloud.vision.v1p1beta1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1p1beta1.Image - * @instance - */ - Image.prototype.source = null; - - /** - * Creates a new Image instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.Image - * @static - * @param {google.cloud.vision.v1p1beta1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Image} Image instance - */ - Image.create = function create(properties) { - return new Image(properties); - }; - - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Image.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Image - * @static - * @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 - */ - Image.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && Object.hasOwnProperty.call(message, "source")) - $root.google.cloud.vision.v1p1beta1.ImageSource.encode(message.source, 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.v1p1beta1.Image.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Image - * @static - * @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 - */ - Image.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Image message from the specified reader or buffer. - * @function decode - * @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.Image} Image - * @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) { - 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(); - 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.v1p1beta1.ImageSource.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Image - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Image.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Image message. - * @function verify - * @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 - */ - Image.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; - } - return null; - }; - - /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Image - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Image} Image - */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Image) - 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 >= 0) - 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 an Image message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Image - * @static - * @param {google.cloud.vision.v1p1beta1.Image} message Image - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Image.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 (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 Image to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Image - * @instance - * @returns {Object.} JSON object - */ - Image.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Image - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Image - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Image.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Image"; - }; - - return Image; - })(); - - 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 - */ - - /** - * Constructs a new FaceAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation - * @constructor - * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * 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; - - /** - * FaceAnnotation panAngle. - * @member {number} panAngle - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.panAngle = 0; - - /** - * FaceAnnotation tiltAngle. - * @member {number} tiltAngle - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.tiltAngle = 0; - - /** - * FaceAnnotation detectionConfidence. - * @member {number} detectionConfidence - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.detectionConfidence = 0; - - /** - * FaceAnnotation landmarkingConfidence. - * @member {number} landmarkingConfidence - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarkingConfidence = 0; - - /** - * FaceAnnotation joyLikelihood. - * @member {google.cloud.vision.v1p1beta1.Likelihood} joyLikelihood - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.joyLikelihood = 0; - - /** - * 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.FaceAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation instance - */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); - }; - - /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.verify|verify} messages. - * @function encode - * @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.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && Object.hasOwnProperty.call(message, "panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && Object.hasOwnProperty.call(message, "tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && Object.hasOwnProperty.call(message, "detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && Object.hasOwnProperty.call(message, "landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && Object.hasOwnProperty.call(message, "joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && Object.hasOwnProperty.call(message, "sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && Object.hasOwnProperty.call(message, "angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && Object.hasOwnProperty.call(message, "surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && Object.hasOwnProperty.call(message, "underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && Object.hasOwnProperty.call(message, "blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && Object.hasOwnProperty.call(message, "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.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.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.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.v1p1beta1.FaceAnnotation(); - 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()); - break; - } - case 2: { - message.fdBoundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); - 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(); - 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.v1p1beta1.FaceAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p1beta1.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.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) { - 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.FaceAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation - */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.FaceAnnotation) - 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) { - default: - if (typeof object.joyLikelihood === "number") { - message.joyLikelihood = object.joyLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.sorrowLikelihood === "number") { - message.sorrowLikelihood = object.sorrowLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.angerLikelihood === "number") { - message.angerLikelihood = object.angerLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.surpriseLikelihood === "number") { - message.surpriseLikelihood = object.surpriseLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.underExposedLikelihood === "number") { - message.underExposedLikelihood = object.underExposedLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.blurredLikelihood === "number") { - message.blurredLikelihood = object.blurredLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.headwearLikelihood === "number") { - message.headwearLikelihood = object.headwearLikelihood; - break; - } - break; - 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 FaceAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.FaceAnnotation} message FaceAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FaceAnnotation.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); - } - 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] === undefined ? message.joyLikelihood : $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] === undefined ? message.sorrowLikelihood : $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] === undefined ? message.angerLikelihood : $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] === undefined ? message.surpriseLikelihood : $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] === undefined ? message.underExposedLikelihood : $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] === undefined ? message.blurredLikelihood : $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] === undefined ? message.headwearLikelihood : $root.google.cloud.vision.v1p1beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; - return object; - }; - - /** - * Converts this FaceAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - * @returns {Object.} JSON object - */ - FaceAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FaceAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FaceAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.FaceAnnotation"; - }; - - 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 - */ - - /** - * 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]]; - } - - /** - * 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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && Object.hasOwnProperty.call(message, "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) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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] === undefined ? message.type : $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); - }; - - /** - * Gets the default type url for Landmark - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Landmark.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type - * @enum {number} - * @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() { - - /** - * Properties of a LocationInfo. - * @memberof google.cloud.vision.v1p1beta1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng - */ - - /** - * Constructs a new LocationInfo. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a LocationInfo. - * @implements ILocationInfo - * @constructor - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.LocationInfo - * @instance - */ - LocationInfo.prototype.latLng = null; - - /** - * Creates a new LocationInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p1beta1.ILocationInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo instance - */ - LocationInfo.create = function create(properties) { - return new LocationInfo(properties); - }; - - /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p1beta1.LocationInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.LocationInfo - * @static - * @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 - */ - LocationInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLng != null && Object.hasOwnProperty.call(message, "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.v1p1beta1.LocationInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.LocationInfo - * @static - * @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 - */ - 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.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.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.v1p1beta1.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.v1p1beta1.LocationInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p1beta1.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.v1p1beta1.LocationInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo - */ - LocationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.LocationInfo) - 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); - } - return message; - }; - - /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p1beta1.LocationInfo} message LocationInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LocationInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.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.v1p1beta1.LocationInfo - * @instance - * @returns {Object.} JSON object - */ - LocationInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocationInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.LocationInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.LocationInfo"; - }; - - return LocationInfo; - })(); - - v1p1beta1.Property = (function() { - - /** - * Properties of a Property. - * @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 - */ - - /** - * Constructs a new Property. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Property. - * @implements IProperty - * @constructor - * @param {google.cloud.vision.v1p1beta1.IProperty=} [properties] Properties to set - */ - function Property(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1p1beta1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * 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.Property - * @static - * @param {google.cloud.vision.v1p1beta1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Property} Property instance - */ - Property.create = function create(properties) { - return new Property(properties); - }; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Property.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Property - * @static - * @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 - */ - Property.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && Object.hasOwnProperty.call(message, "uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); - return writer; - }; - - /** - * 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.Property - * @static - * @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 - */ - Property.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Property message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.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.Property} Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Property.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.Property(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - case 3: { - message.uint64Value = reader.uint64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Property - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Property.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Property message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.Property - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Property.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.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 Property message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Property - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Property} Property - */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Property) - 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); - return message; - }; - - /** - * Creates a plain object from a Property message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Property - * @static - * @param {google.cloud.vision.v1p1beta1.Property} message Property - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Property.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.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 Property to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Property - * @instance - * @returns {Object.} JSON object - */ - Property.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Property - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Property - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Property"; - }; - - return Property; - })(); - - v1p1beta1.EntityAnnotation = (function() { - - /** - * Properties of an EntityAnnotation. - * @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 - */ - - /** - * Constructs a new EntityAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation - * @constructor - * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.mid = ""; - - /** - * 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.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation instance - */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); - }; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.EntityAnnotation.verify|verify} messages. - * @function encode - * @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.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && Object.hasOwnProperty.call(message, "locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && Object.hasOwnProperty.call(message, "topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "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(); - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer. - * @function decode - * @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.EntityAnnotation} EntityAnnotation - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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); - break; - } - } - return message; - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p1beta1.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.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.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 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 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); - }; - - /** - * Gets the default type url for EntityAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EntityAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.EntityAnnotation"; - }; - - 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 && Object.hasOwnProperty.call(message, "adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && Object.hasOwnProperty.call(message, "spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && Object.hasOwnProperty.call(message, "medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && Object.hasOwnProperty.call(message, "violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && Object.hasOwnProperty.call(message, "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) { - 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; - }; - - /** - * 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) { - 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.v1p1beta1.SafeSearchAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation - */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation(); - switch (object.adult) { - default: - if (typeof object.adult === "number") { - message.adult = object.adult; - break; - } - break; - 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) { - default: - if (typeof object.spoof === "number") { - message.spoof = object.spoof; - break; - } - break; - 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) { - default: - if (typeof object.medical === "number") { - message.medical = object.medical; - break; - } - break; - 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) { - default: - if (typeof object.violence === "number") { - message.violence = object.violence; - break; - } - break; - 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) { - default: - if (typeof object.racy === "number") { - message.racy = object.racy; - break; - } - break; - 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 SafeSearchAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} message SafeSearchAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SafeSearchAnnotation.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.v1p1beta1.Likelihood[message.adult] === undefined ? message.adult : $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] === undefined ? message.spoof : $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] === undefined ? message.medical : $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] === undefined ? message.violence : $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] === undefined ? message.racy : $root.google.cloud.vision.v1p1beta1.Likelihood[message.racy] : message.racy; - return object; - }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @instance - * @returns {Object.} JSON object - */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SafeSearchAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.SafeSearchAnnotation"; - }; - - return SafeSearchAnnotation; - })(); - - v1p1beta1.LatLongRect = (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 - */ - - /** - * 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]]; - } - - /** - * LatLongRect minLatLng. - * @member {google.type.ILatLng|null|undefined} minLatLng - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.minLatLng = null; - - /** - * 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.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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && Object.hasOwnProperty.call(message, "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.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(); - }; - - /** - * 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; - } - } - 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()); - }; - - /** - * 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; - }; - - /** - * 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) - 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 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); - }; - - /** - * Gets the default type url for LatLongRect - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LatLongRect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.LatLongRect"; - }; - - return LatLongRect; - })(); - - v1p1beta1.ColorInfo = (function() { - - /** - * Properties of a ColorInfo. - * @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 - */ - - /** - * Constructs a new ColorInfo. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo - * @constructor - * @param {google.cloud.vision.v1p1beta1.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]]; - } - - /** - * 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 - * @instance - */ - ColorInfo.prototype.pixelFraction = 0; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p1beta1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo instance - */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); - }; - - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ColorInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.ColorInfo - * @static - * @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 - */ - ColorInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.color != null && Object.hasOwnProperty.call(message, "color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && Object.hasOwnProperty.call(message, "pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); - return writer; - }; - - /** - * 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.ColorInfo - * @static - * @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 - */ - ColorInfo.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.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.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.v1p1beta1.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; - } - } - return message; - }; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ColorInfo.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.v1p1beta1.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; - }; - - /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.ColorInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo - */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.ColorInfo) - 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); - } - 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.v1p1beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p1beta1.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 ColorInfo to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.ColorInfo - * @instance - * @returns {Object.} JSON object - */ - ColorInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ColorInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.ColorInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.ColorInfo"; - }; - - return ColorInfo; - })(); - - v1p1beta1.DominantColorsAnnotation = (function() { - - /** - * Properties of a DominantColorsAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors - */ - - /** - * Constructs a new DominantColorsAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation - * @constructor - * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation=} [properties] Properties to set - */ - function DominantColorsAnnotation(properties) { - this.colors = []; - 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]]; - } - - /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @instance - */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation instance - */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); - }; - - /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.DominantColorsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @static - * @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 - */ - 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.v1p1beta1.ColorInfo.encode(message.colors[i], 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.v1p1beta1.DominantColorsAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @static - * @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 - */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. - * @function decode - * @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.DominantColorsAnnotation} DominantColorsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DominantColorsAnnotation message. - * @function verify - * @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 - */ - DominantColorsAnnotation.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; - } - } - return null; - }; - - /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation - */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} message DominantColorsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DominantColorsAnnotation.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); - } - return object; - }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @instance - * @returns {Object.} JSON object - */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DominantColorsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.DominantColorsAnnotation"; - }; - - return DominantColorsAnnotation; - })(); - - v1p1beta1.ImageProperties = (function() { - - /** - * Properties of an ImageProperties. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IImageProperties - * @property {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors - */ - - /** - * Constructs a new ImageProperties. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties - * @constructor - * @param {google.cloud.vision.v1p1beta1.IImageProperties=} [properties] Properties to set - */ - 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]]; - } - - /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1p1beta1.ImageProperties - * @instance - */ - ImageProperties.prototype.dominantColors = null; - - /** - * Creates a new ImageProperties instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.ImageProperties - * @static - * @param {google.cloud.vision.v1p1beta1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties instance - */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); - }; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageProperties.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.ImageProperties - * @static - * @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 - */ - ImageProperties.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dominantColors != null && Object.hasOwnProperty.call(message, "dominantColors")) - $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageProperties - * @static - * @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 - */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer. - * @function decode - * @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.ImageProperties} ImageProperties - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageProperties - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageProperties message. - * @function verify - * @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 - */ - ImageProperties.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 (error) - return "dominantColors." + error; - } - return null; - }; - - /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.ImageProperties - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties - */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageProperties) - 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); - } - return message; - }; - - /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.ImageProperties - * @static - * @param {google.cloud.vision.v1p1beta1.ImageProperties} message ImageProperties - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageProperties.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); - return object; - }; - - /** - * Converts this ImageProperties to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.ImageProperties - * @instance - * @returns {Object.} JSON object - */ - ImageProperties.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageProperties - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.ImageProperties - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.ImageProperties"; - }; - - return ImageProperties; - })(); - - v1p1beta1.CropHint = (function() { - - /** - * Properties of a CropHint. - * @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 - */ - - /** - * Constructs a new CropHint. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a CropHint. - * @implements ICropHint - * @constructor - * @param {google.cloud.vision.v1p1beta1.ICropHint=} [properties] Properties to set - */ - function CropHint(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]]; - } - - /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @instance - */ - CropHint.prototype.boundingPoly = null; - - /** - * CropHint confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @instance - */ - CropHint.prototype.confidence = 0; - - /** - * CropHint importanceFraction. - * @member {number} importanceFraction - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @instance - */ - CropHint.prototype.importanceFraction = 0; - - /** - * Creates a new CropHint instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @static - * @param {google.cloud.vision.v1p1beta1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint instance - */ - CropHint.create = function create(properties) { - return new CropHint(properties); - }; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHint.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @static - * @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 - */ - CropHint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && Object.hasOwnProperty.call(message, "importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); - return writer; - }; - - /** - * 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.CropHint - * @static - * @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 - */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHint message from the specified reader or buffer. - * @function decode - * @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.CropHint} CropHint - * @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) { - 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(); - 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()); - break; - } - case 2: { - message.confidence = reader.float(); - break; - } - case 3: { - message.importanceFraction = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHint message. - * @function verify - * @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 - */ - CropHint.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"; - return null; - }; - - /** - * Creates a CropHint message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint - */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHint) - 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); - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @static - * @param {google.cloud.vision.v1p1beta1.CropHint} message CropHint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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.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 CropHint to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @instance - * @returns {Object.} JSON object - */ - CropHint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHint - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.CropHint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.CropHint"; - }; - - return CropHint; - })(); - - v1p1beta1.CropHintsAnnotation = (function() { - - /** - * Properties of a CropHintsAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints - */ - - /** - * Constructs a new CropHintsAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation - * @constructor - * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation - * @instance - */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation instance - */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); - }; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.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(); - return writer; - }; - - /** - * 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.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. - * @function decode - * @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.CropHintsAnnotation} CropHintsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsAnnotation message. - * @function verify - * @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 - */ - CropHintsAnnotation.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; - } - } - return null; - }; - - /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation - */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.CropHintsAnnotation} message CropHintsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsAnnotation.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); - } - return object; - }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation - * @instance - * @returns {Object.} JSON object - */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.CropHintsAnnotation"; - }; - - return CropHintsAnnotation; - })(); - - v1p1beta1.CropHintsParams = (function() { - - /** - * Properties of a CropHintsParams. - * @memberof google.cloud.vision.v1p1beta1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios - */ - - /** - * Constructs a new CropHintsParams. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams - * @constructor - * @param {google.cloud.vision.v1p1beta1.ICropHintsParams=} [properties] Properties to set - */ - function CropHintsParams(properties) { - this.aspectRatios = []; - 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]]; - } - - /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams - * @instance - */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams - * @static - * @param {google.cloud.vision.v1p1beta1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams instance - */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); - }; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams - * @static - * @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 - */ - CropHintsParams.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(); - } - return writer; - }; - - /** - * 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.CropHintsParams - * @static - * @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 - */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer. - * @function decode - * @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.CropHintsParams} CropHintsParams - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsParams message. - * @function verify - * @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 - */ - CropHintsParams.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"; - } - return null; - }; - - /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams - */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHintsParams) - 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]); - } - return message; - }; - - /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams - * @static - * @param {google.cloud.vision.v1p1beta1.CropHintsParams} message CropHintsParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsParams.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]; - } - return object; - }; - - /** - * Converts this CropHintsParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams - * @instance - * @returns {Object.} JSON object - */ - CropHintsParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.CropHintsParams"; - }; - - return CropHintsParams; - })(); - - v1p1beta1.WebDetectionParams = (function() { - - /** - * Properties of a WebDetectionParams. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults - */ - - /** - * Constructs a new WebDetectionParams. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams - * @constructor - * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams=} [properties] Properties to set - */ - function WebDetectionParams(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]]; - } - - /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams - * @instance - */ - WebDetectionParams.prototype.includeGeoResults = false; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams instance - */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); - }; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.includeGeoResults != null && Object.hasOwnProperty.call(message, "includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); - return writer; - }; - - /** - * 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.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer. - * @function decode - * @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.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.v1p1beta1.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.v1p1beta1.WebDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p1beta1.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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams - */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.WebDetectionParams) - return object; - 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 WebDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetectionParams} message WebDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebDetectionParams.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; - return object; - }; - - /** - * Converts this WebDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams - * @instance - * @returns {Object.} JSON object - */ - WebDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.WebDetectionParams"; - }; - - return WebDetectionParams; - })(); - - v1p1beta1.TextDetectionParams = (function() { - - /** - * Properties of a TextDetectionParams. - * @memberof google.cloud.vision.v1p1beta1 - * @interface ITextDetectionParams - * @property {boolean|null} [enableTextDetectionConfidenceScore] TextDetectionParams enableTextDetectionConfidenceScore - * @property {Array.|null} [advancedOcrOptions] TextDetectionParams advancedOcrOptions - */ - - /** - * Constructs a new TextDetectionParams. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a TextDetectionParams. - * @implements ITextDetectionParams - * @constructor - * @param {google.cloud.vision.v1p1beta1.ITextDetectionParams=} [properties] Properties to set - */ - function TextDetectionParams(properties) { - this.advancedOcrOptions = []; - 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]]; - } - - /** - * TextDetectionParams enableTextDetectionConfidenceScore. - * @member {boolean} enableTextDetectionConfidenceScore - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.enableTextDetectionConfidenceScore = false; - - /** - * TextDetectionParams advancedOcrOptions. - * @member {Array.} advancedOcrOptions - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.advancedOcrOptions = $util.emptyArray; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p1beta1.ITextDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.TextDetectionParams} TextDetectionParams instance - */ - TextDetectionParams.create = function create(properties) { - return new TextDetectionParams(properties); - }; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p1beta1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enableTextDetectionConfidenceScore != null && Object.hasOwnProperty.call(message, "enableTextDetectionConfidenceScore")) - writer.uint32(/* id 9, wireType 0 =*/72).bool(message.enableTextDetectionConfidenceScore); - if (message.advancedOcrOptions != null && message.advancedOcrOptions.length) - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.advancedOcrOptions[i]); - return writer; - }; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextDetectionParams.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p1beta1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @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.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decode = function decode(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.TextDetectionParams(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 9: { - message.enableTextDetectionConfidenceScore = reader.bool(); - break; - } - case 11: { - if (!(message.advancedOcrOptions && message.advancedOcrOptions.length)) - message.advancedOcrOptions = []; - message.advancedOcrOptions.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TextDetectionParams message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TextDetectionParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - if (typeof message.enableTextDetectionConfidenceScore !== "boolean") - return "enableTextDetectionConfidenceScore: boolean expected"; - if (message.advancedOcrOptions != null && message.hasOwnProperty("advancedOcrOptions")) { - if (!Array.isArray(message.advancedOcrOptions)) - return "advancedOcrOptions: array expected"; - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - if (!$util.isString(message.advancedOcrOptions[i])) - return "advancedOcrOptions: string[] expected"; - } - return null; - }; - - /** - * Creates a TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.TextDetectionParams} TextDetectionParams - */ - TextDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.TextDetectionParams) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.TextDetectionParams(); - if (object.enableTextDetectionConfidenceScore != null) - message.enableTextDetectionConfidenceScore = Boolean(object.enableTextDetectionConfidenceScore); - if (object.advancedOcrOptions) { - if (!Array.isArray(object.advancedOcrOptions)) - throw TypeError(".google.cloud.vision.v1p1beta1.TextDetectionParams.advancedOcrOptions: array expected"); - message.advancedOcrOptions = []; - for (var i = 0; i < object.advancedOcrOptions.length; ++i) - message.advancedOcrOptions[i] = String(object.advancedOcrOptions[i]); - } - return message; - }; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p1beta1.TextDetectionParams} message TextDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TextDetectionParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.advancedOcrOptions = []; - if (options.defaults) - object.enableTextDetectionConfidenceScore = false; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - object.enableTextDetectionConfidenceScore = message.enableTextDetectionConfidenceScore; - if (message.advancedOcrOptions && message.advancedOcrOptions.length) { - object.advancedOcrOptions = []; - for (var j = 0; j < message.advancedOcrOptions.length; ++j) - object.advancedOcrOptions[j] = message.advancedOcrOptions[j]; - } - return object; - }; - - /** - * Converts this TextDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @instance - * @returns {Object.} JSON object - */ - TextDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.TextDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.TextDetectionParams"; - }; - - return TextDetectionParams; - })(); - - v1p1beta1.ImageContext = (function() { - - /** - * Properties of an ImageContext. - * @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 - * @property {google.cloud.vision.v1p1beta1.ITextDetectionParams|null} [textDetectionParams] ImageContext textDetectionParams - */ - - /** - * Constructs a new ImageContext. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an ImageContext. - * @implements IImageContext - * @constructor - * @param {google.cloud.vision.v1p1beta1.IImageContext=} [properties] Properties to set - */ - function ImageContext(properties) { - this.languageHints = []; - 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]]; - } - - /** - * 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 - * @instance - */ - ImageContext.prototype.webDetectionParams = null; - - /** - * ImageContext textDetectionParams. - * @member {google.cloud.vision.v1p1beta1.ITextDetectionParams|null|undefined} textDetectionParams - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @instance - */ - ImageContext.prototype.textDetectionParams = null; - - /** - * Creates a new ImageContext instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @static - * @param {google.cloud.vision.v1p1beta1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext instance - */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); - }; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @static - * @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 - */ - ImageContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLongRect != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "cropHintsParams")) - $root.google.cloud.vision.v1p1beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.webDetectionParams != null && Object.hasOwnProperty.call(message, "webDetectionParams")) - $root.google.cloud.vision.v1p1beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.textDetectionParams != null && Object.hasOwnProperty.call(message, "textDetectionParams")) - $root.google.cloud.vision.v1p1beta1.TextDetectionParams.encode(message.textDetectionParams, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageContext - * @static - * @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 - */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer. - * @function decode - * @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.ImageContext} ImageContext - * @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) { - 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(); - 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()); - break; - } - case 12: { - message.textDetectionParams = $root.google.cloud.vision.v1p1beta1.TextDetectionParams.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageContext message. - * @function verify - * @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 - */ - ImageContext.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 (error) - return "webDetectionParams." + error; - } - if (message.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) { - var error = $root.google.cloud.vision.v1p1beta1.TextDetectionParams.verify(message.textDetectionParams); - if (error) - return "textDetectionParams." + error; - } - return null; - }; - - /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext - */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageContext) - 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); - } - if (object.textDetectionParams != null) { - if (typeof object.textDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.textDetectionParams: object expected"); - message.textDetectionParams = $root.google.cloud.vision.v1p1beta1.TextDetectionParams.fromObject(object.textDetectionParams); - } - return message; - }; - - /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @static - * @param {google.cloud.vision.v1p1beta1.ImageContext} message ImageContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageContext.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; - object.textDetectionParams = 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 (message.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) - object.textDetectionParams = $root.google.cloud.vision.v1p1beta1.TextDetectionParams.toObject(message.textDetectionParams, options); - return object; - }; - - /** - * Converts this ImageContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @instance - * @returns {Object.} JSON object - */ - ImageContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.ImageContext"; - }; - - return ImageContext; - })(); - - v1p1beta1.AnnotateImageRequest = (function() { - - /** - * Properties of an AnnotateImageRequest. - * @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 - */ - - /** - * Constructs a new AnnotateImageRequest. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest - * @constructor - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.IImage|null|undefined} image - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.image = null; - - /** - * 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.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest instance - */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); - }; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.image != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1p1beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. - * @function decode - * @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.AnnotateImageRequest} AnnotateImageRequest - * @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) { - 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(); - 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()); - 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); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateImageRequest message. - * @function verify - * @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 - */ - AnnotateImageRequest.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 (error) - return "imageContext." + error; - } - return null; - }; - - /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest - */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1p1beta1.AnnotateImageRequest} message AnnotateImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateImageRequest.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); - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1p1beta1.ImageContext.toObject(message.imageContext, options); - return object; - }; - - /** - * Converts this AnnotateImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.AnnotateImageRequest"; - }; - - return AnnotateImageRequest; - })(); - - v1p1beta1.AnnotateImageResponse = (function() { - - /** - * Properties of an AnnotateImageResponse. - * @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 - */ - - /** - * Constructs a new AnnotateImageResponse. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse - * @constructor - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * 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 - * @instance - */ - AnnotateImageResponse.prototype.error = null; - - /** - * Creates a new AnnotateImageResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse instance - */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); - }; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.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 && Object.hasOwnProperty.call(message, "safeSearchAnnotation")) - $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && Object.hasOwnProperty.call(message, "imagePropertiesAnnotation")) - $root.google.cloud.vision.v1p1beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && Object.hasOwnProperty.call(message, "cropHintsAnnotation")) - $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && Object.hasOwnProperty.call(message, "fullTextAnnotation")) - $root.google.cloud.vision.v1p1beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && Object.hasOwnProperty.call(message, "webDetection")) - $root.google.cloud.vision.v1p1beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. - * @function decode - * @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.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.v1p1beta1.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.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()); - 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.v1p1beta1.AnnotateImageResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p1beta1.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.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 - */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse) - 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]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1p1beta1.AnnotateImageResponse} message AnnotateImageResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.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 (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. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.AnnotateImageResponse"; - }; - - return AnnotateImageResponse; - })(); - - v1p1beta1.BatchAnnotateImagesRequest = (function() { - - /** - * Properties of a BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests - */ - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest - * @constructor - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest - * @instance - */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance - */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest - * @static - * @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 - */ - 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.v1p1beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.BatchAnnotateImagesRequest - * @static - * @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 - */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateImagesRequest message. - * @function verify - * @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 - */ - 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.v1p1beta1.AnnotateImageRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } - return null; - }; - - /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchAnnotateImagesRequest.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); - } - return object; - }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest"; - }; - - return BatchAnnotateImagesRequest; - })(); - - v1p1beta1.BatchAnnotateImagesResponse = (function() { - - /** - * Properties of a BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses - */ - - /** - * 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]]; - } - - /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse - * @instance - */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; - - /** - * 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); - }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse"; - }; - - return BatchAnnotateImagesResponse; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1p1beta1.Likelihood - * @enum {number} - * @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 && Object.hasOwnProperty.call(message, "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); - }; - - /** - * Gets the default type url for TextAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.TextAnnotation"; - }; - - 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 - * @param {google.cloud.vision.v1p1beta1.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 && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p1beta1.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(); - }; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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; - }; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.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()); - }; - - /** - * Verifies a DetectedLanguage message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.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; - }; - - /** - * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage} DetectedLanguage - */ - DetectedLanguage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage(); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p1beta1.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; - return object; - }; - - /** - * Converts this DetectedLanguage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @instance - * @returns {Object.} JSON object - */ - DetectedLanguage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DetectedLanguage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage"; - }; - - return DetectedLanguage; - })(); - - TextAnnotation.DetectedBreak = (function() { - - /** - * Properties of a DetectedBreak. - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation - * @interface IDetectedBreak - * @property {google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType|null} [type] DetectedBreak type - * @property {boolean|null} [isPrefix] DetectedBreak isPrefix - */ - - /** - * Constructs a new DetectedBreak. - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation - * @classdesc Represents a DetectedBreak. - * @implements IDetectedBreak - * @constructor - * @param {google.cloud.vision.v1p1beta1.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]]; - } - - /** - * DetectedBreak type. - * @member {google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType} type - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.type = 0; - - /** - * DetectedBreak isPrefix. - * @member {boolean} isPrefix - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.isPrefix = false; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak} DetectedBreak instance - */ - DetectedBreak.create = function create(properties) { - return new DetectedBreak(properties); - }; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p1beta1.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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.isPrefix != null && Object.hasOwnProperty.call(message, "isPrefix")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isPrefix); - return writer; - }; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p1beta1.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(); - }; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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; - }; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.TextAnnotation.DetectedBreak - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak} DetectedBreak - */ - DetectedBreak.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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.v1p1beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.DetectedBreak.BreakType[message.type] === undefined ? message.type : $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.DetectedBreak - * @instance - * @returns {Object.} JSON object - */ - DetectedBreak.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DetectedBreak - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak"; - }; - - /** - * BreakType enum. - * @name google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.BreakType - * @enum {number} - * @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.v1p1beta1.TextAnnotation - * @interface ITextProperty - * @property {Array.|null} [detectedLanguages] TextProperty detectedLanguages - * @property {google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak|null} [detectedBreak] TextProperty detectedBreak - */ - - /** - * Constructs a new TextProperty. - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation - * @classdesc Represents a TextProperty. - * @implements ITextProperty - * @constructor - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedLanguages = $util.emptyArray; - - /** - * TextProperty detectedBreak. - * @member {google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedBreak|null|undefined} detectedBreak - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedBreak = null; - - /** - * Creates a new TextProperty instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.detectedBreak != null && Object.hasOwnProperty.call(message, "detectedBreak")) - $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.TextAnnotation.DetectedLanguage.decode(reader, reader.uint32())); - break; - } - case 2: { - message.detectedBreak = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.TextAnnotation.DetectedLanguage.verify(message.detectedLanguages[i]); - if (error) - return "detectedLanguages." + error; - } - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { - var error = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty} TextProperty - */ - TextProperty.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty(); - if (object.detectedLanguages) { - if (!Array.isArray(object.detectedLanguages)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.detectedLanguages: object expected"); - message.detectedLanguages[i] = $root.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage.fromObject(object.detectedLanguages[i]); - } - } - if (object.detectedBreak != null) { - if (typeof object.detectedBreak !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.detectedBreak: object expected"); - message.detectedBreak = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.DetectedLanguage.toObject(message.detectedLanguages[j], options); - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) - object.detectedBreak = $root.google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak.toObject(message.detectedBreak, options); - return object; - }; - - /** - * Converts this TextProperty to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty - * @instance - * @returns {Object.} JSON object - */ - TextProperty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextProperty - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextProperty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty"; - }; - - return TextProperty; - })(); - - return TextAnnotation; - })(); - - v1p1beta1.Page = (function() { - - /** - * Properties of a Page. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IPage - * @property {google.cloud.vision.v1p1beta1.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.v1p1beta1 - * @classdesc Represents a Page. - * @implements IPage - * @constructor - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p1beta1.Page - * @instance - */ - Page.prototype.property = null; - - /** - * Page width. - * @member {number} width - * @memberof google.cloud.vision.v1p1beta1.Page - * @instance - */ - Page.prototype.width = 0; - - /** - * Page height. - * @member {number} height - * @memberof google.cloud.vision.v1p1beta1.Page - * @instance - */ - Page.prototype.height = 0; - - /** - * Page blocks. - * @member {Array.} blocks - * @memberof google.cloud.vision.v1p1beta1.Page - * @instance - */ - Page.prototype.blocks = $util.emptyArray; - - /** - * Page confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.Page - * @instance - */ - Page.prototype.confidence = 0; - - /** - * Creates a new Page instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.Page - * @static - * @param {google.cloud.vision.v1p1beta1.IPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Page} Page instance - */ - Page.create = function create(properties) { - return new Page(properties); - }; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Page.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Page - * @static - * @param {google.cloud.vision.v1p1beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.width); - if (message.height != null && Object.hasOwnProperty.call(message, "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.v1p1beta1.Block.encode(message.blocks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p1beta1.Page.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Page - * @static - * @param {google.cloud.vision.v1p1beta1.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(); - }; - - /** - * Decodes a Page message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.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.v1p1beta1.Page} Page - * @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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.Page(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Block.decode(reader, reader.uint32())); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Page - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.Page} Page - * @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) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Page message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.Page - * @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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + 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.v1p1beta1.Block.verify(message.blocks[i]); - if (error) - return "blocks." + 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. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Page - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Page} Page - */ - Page.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Page) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.Page(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Page.property: object expected"); - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - 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.v1p1beta1.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.v1p1beta1.Page.blocks: object expected"); - message.blocks[i] = $root.google.cloud.vision.v1p1beta1.Block.fromObject(object.blocks[i]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Page - * @static - * @param {google.cloud.vision.v1p1beta1.Page} message Page - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.width = 0; - object.height = 0; - object.confidence = 0; - } - if (message.property != null && message.hasOwnProperty("property")) - object.property = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.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 Page to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Page - * @instance - * @returns {Object.} JSON object - */ - Page.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Page - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Page - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Page"; - }; - - return Page; - })(); - - v1p1beta1.Block = (function() { - - /** - * Properties of a Block. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IBlock - * @property {google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null} [property] Block property - * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [boundingBox] Block boundingBox - * @property {Array.|null} [paragraphs] Block paragraphs - * @property {google.cloud.vision.v1p1beta1.Block.BlockType|null} [blockType] Block blockType - * @property {number|null} [confidence] Block confidence - */ - - /** - * Constructs a new Block. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Block. - * @implements IBlock - * @constructor - * @param {google.cloud.vision.v1p1beta1.IBlock=} [properties] Properties to set - */ - function Block(properties) { - this.paragraphs = []; - 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]]; - } - - /** - * Block property. - * @member {google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p1beta1.Block - * @instance - */ - Block.prototype.property = null; - - /** - * Block boundingBox. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p1beta1.Block - * @instance - */ - Block.prototype.boundingBox = null; - - /** - * Block paragraphs. - * @member {Array.} paragraphs - * @memberof google.cloud.vision.v1p1beta1.Block - * @instance - */ - Block.prototype.paragraphs = $util.emptyArray; - - /** - * Block blockType. - * @member {google.cloud.vision.v1p1beta1.Block.BlockType} blockType - * @memberof google.cloud.vision.v1p1beta1.Block - * @instance - */ - Block.prototype.blockType = 0; - - /** - * Block confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.Block - * @instance - */ - Block.prototype.confidence = 0; - - /** - * Creates a new Block instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.Block - * @static - * @param {google.cloud.vision.v1p1beta1.IBlock=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Block} Block instance - */ - Block.create = function create(properties) { - return new Block(properties); - }; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Block.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Block - * @static - * @param {google.cloud.vision.v1p1beta1.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.property != null && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.blockType != null && Object.hasOwnProperty.call(message, "blockType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.blockType); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Block.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Block - * @static - * @param {google.cloud.vision.v1p1beta1.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Block message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.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.v1p1beta1.Block} Block - * @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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.Block(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.vision.v1p1beta1.Paragraph.decode(reader, reader.uint32())); - break; - } - case 4: { - message.blockType = reader.int32(); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Block - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.Block} Block - * @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) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Block message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.Block - * @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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Paragraph.verify(message.paragraphs[i]); - if (error) - return "paragraphs." + 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 Block message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Block - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Block} Block - */ - Block.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Block) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.Block(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Block.property: object expected"); - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Block.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.paragraphs) { - if (!Array.isArray(object.paragraphs)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.Block.paragraphs: object expected"); - message.paragraphs[i] = $root.google.cloud.vision.v1p1beta1.Paragraph.fromObject(object.paragraphs[i]); - } - } - switch (object.blockType) { - default: - if (typeof object.blockType === "number") { - message.blockType = object.blockType; - break; - } - break; - 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 Block message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Block - * @static - * @param {google.cloud.vision.v1p1beta1.Block} message Block - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Block.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.v1p1beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Paragraph.toObject(message.paragraphs[j], options); - } - if (message.blockType != null && message.hasOwnProperty("blockType")) - object.blockType = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Block.BlockType[message.blockType] === undefined ? message.blockType : $root.google.cloud.vision.v1p1beta1.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 Block to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Block - * @instance - * @returns {Object.} JSON object - */ - Block.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Block - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Block - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Block"; - }; - - /** - * BlockType enum. - * @name google.cloud.vision.v1p1beta1.Block.BlockType - * @enum {number} - * @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; - })(); - - return Block; - })(); - - v1p1beta1.Paragraph = (function() { - - /** - * Properties of a Paragraph. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IParagraph - * @property {google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null} [property] Paragraph property - * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [boundingBox] Paragraph boundingBox - * @property {Array.|null} [words] Paragraph words - * @property {number|null} [confidence] Paragraph confidence - */ - - /** - * Constructs a new Paragraph. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Paragraph. - * @implements IParagraph - * @constructor - * @param {google.cloud.vision.v1p1beta1.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]]; - } - - /** - * Paragraph property. - * @member {google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p1beta1.Paragraph - * @instance - */ - Paragraph.prototype.property = null; - - /** - * Paragraph boundingBox. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p1beta1.Paragraph - * @instance - */ - Paragraph.prototype.boundingBox = null; - - /** - * Paragraph words. - * @member {Array.} words - * @memberof google.cloud.vision.v1p1beta1.Paragraph - * @instance - */ - Paragraph.prototype.words = $util.emptyArray; - - /** - * Paragraph confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.Paragraph - * @instance - */ - Paragraph.prototype.confidence = 0; - - /** - * Creates a new Paragraph instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p1beta1.IParagraph=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Paragraph} Paragraph instance - */ - Paragraph.create = function create(properties) { - return new Paragraph(properties); - }; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Paragraph.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p1beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Word.encode(message.words[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p1beta1.Paragraph.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.Paragraph(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.words && message.words.length)) - message.words = []; - message.words.push($root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Paragraph - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.Paragraph - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Paragraph} Paragraph - */ - Paragraph.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Paragraph) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.Paragraph(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Paragraph.property: object expected"); - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Paragraph.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.words) { - if (!Array.isArray(object.words)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.Paragraph.words: object expected"); - message.words[i] = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.Paragraph - * @instance - * @returns {Object.} JSON object - */ - Paragraph.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Paragraph - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Paragraph - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Paragraph"; - }; - - return Paragraph; - })(); - - v1p1beta1.Word = (function() { - - /** - * Properties of a Word. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IWord - * @property {google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null} [property] Word property - * @property {google.cloud.vision.v1p1beta1.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.v1p1beta1 - * @classdesc Represents a Word. - * @implements IWord - * @constructor - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p1beta1.Word - * @instance - */ - Word.prototype.property = null; - - /** - * Word boundingBox. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p1beta1.Word - * @instance - */ - Word.prototype.boundingBox = null; - - /** - * Word symbols. - * @member {Array.} symbols - * @memberof google.cloud.vision.v1p1beta1.Word - * @instance - */ - Word.prototype.symbols = $util.emptyArray; - - /** - * Word confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.Word - * @instance - */ - Word.prototype.confidence = 0; - - /** - * Creates a new Word instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.Word - * @static - * @param {google.cloud.vision.v1p1beta1.IWord=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Word} Word instance - */ - Word.create = function create(properties) { - return new Word(properties); - }; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Word.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Word - * @static - * @param {google.cloud.vision.v1p1beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Symbol.encode(message.symbols[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p1beta1.Word.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Word - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.Word(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.symbols && message.symbols.length)) - message.symbols = []; - message.symbols.push($root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Word - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.Word - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Word} Word - */ - Word.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Word) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.Word(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Word.property: object expected"); - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Word.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.symbols) { - if (!Array.isArray(object.symbols)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.Word.symbols: object expected"); - message.symbols[i] = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Word - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.Word - * @instance - * @returns {Object.} JSON object - */ - Word.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Word - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Word - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Word.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Word"; - }; - - return Word; - })(); - - v1p1beta1.Symbol = (function() { - - /** - * Properties of a Symbol. - * @memberof google.cloud.vision.v1p1beta1 - * @interface ISymbol - * @property {google.cloud.vision.v1p1beta1.TextAnnotation.ITextProperty|null} [property] Symbol property - * @property {google.cloud.vision.v1p1beta1.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.v1p1beta1 - * @classdesc Represents a Symbol. - * @implements ISymbol - * @constructor - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p1beta1.Symbol - * @instance - */ - Symbol.prototype.property = null; - - /** - * Symbol boundingBox. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p1beta1.Symbol - * @instance - */ - Symbol.prototype.boundingBox = null; - - /** - * Symbol text. - * @member {string} text - * @memberof google.cloud.vision.v1p1beta1.Symbol - * @instance - */ - Symbol.prototype.text = ""; - - /** - * Symbol confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.Symbol - * @instance - */ - Symbol.prototype.confidence = 0; - - /** - * Creates a new Symbol instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.Symbol - * @static - * @param {google.cloud.vision.v1p1beta1.ISymbol=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Symbol} Symbol instance - */ - Symbol.create = function create(properties) { - return new Symbol(properties); - }; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Symbol.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.Symbol - * @static - * @param {google.cloud.vision.v1p1beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "text")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.text); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p1beta1.Symbol.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Symbol - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.Symbol(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Symbol - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Symbol - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Symbol} Symbol - */ - Symbol.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Symbol) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.Symbol(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Symbol.property: object expected"); - message.property = $root.google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Symbol.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Symbol - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.Symbol - * @instance - * @returns {Object.} JSON object - */ - Symbol.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Symbol - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.Symbol - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Symbol.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.Symbol"; - }; - - return Symbol; - })(); - - v1p1beta1.WebDetection = (function() { - - /** - * Properties of a WebDetection. - * @memberof google.cloud.vision.v1p1beta1 - * @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.v1p1beta1 - * @classdesc Represents a WebDetection. - * @implements IWebDetection - * @constructor - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection - * @instance - */ - WebDetection.prototype.webEntities = $util.emptyArray; - - /** - * WebDetection fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @instance - */ - WebDetection.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebDetection partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @instance - */ - WebDetection.prototype.partialMatchingImages = $util.emptyArray; - - /** - * WebDetection pagesWithMatchingImages. - * @member {Array.} pagesWithMatchingImages - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @instance - */ - WebDetection.prototype.pagesWithMatchingImages = $util.emptyArray; - - /** - * WebDetection visuallySimilarImages. - * @member {Array.} visuallySimilarImages - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @instance - */ - WebDetection.prototype.visuallySimilarImages = $util.emptyArray; - - /** - * WebDetection bestGuessLabels. - * @member {Array.} bestGuessLabels - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @instance - */ - WebDetection.prototype.bestGuessLabels = $util.emptyArray; - - /** - * Creates a new WebDetection instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p1beta1.IWebDetection=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.WebDetection} WebDetection instance - */ - WebDetection.create = function create(properties) { - return new WebDetection(properties); - }; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.WebDetection.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.WebDetection.WebEntity.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 4: { - if (!(message.pagesWithMatchingImages && message.pagesWithMatchingImages.length)) - message.pagesWithMatchingImages = []; - message.pagesWithMatchingImages.push($root.google.cloud.vision.v1p1beta1.WebDetection.WebPage.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.visuallySimilarImages && message.visuallySimilarImages.length)) - message.visuallySimilarImages = []; - message.visuallySimilarImages.push($root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 8: { - if (!(message.bestGuessLabels && message.bestGuessLabels.length)) - message.bestGuessLabels = []; - message.bestGuessLabels.push($root.google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.WebDetection - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.WebDetection} WebDetection - */ - WebDetection.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.WebDetection) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.WebDetection(); - if (object.webEntities) { - if (!Array.isArray(object.webEntities)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.webEntities: object expected"); - message.webEntities[i] = $root.google.cloud.vision.v1p1beta1.WebDetection.WebEntity.fromObject(object.webEntities[i]); - } - } - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - if (object.pagesWithMatchingImages) { - if (!Array.isArray(object.pagesWithMatchingImages)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.pagesWithMatchingImages: object expected"); - message.pagesWithMatchingImages[i] = $root.google.cloud.vision.v1p1beta1.WebDetection.WebPage.fromObject(object.pagesWithMatchingImages[i]); - } - } - if (object.visuallySimilarImages) { - if (!Array.isArray(object.visuallySimilarImages)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.visuallySimilarImages: object expected"); - message.visuallySimilarImages[i] = $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.fromObject(object.visuallySimilarImages[i]); - } - } - if (object.bestGuessLabels) { - if (!Array.isArray(object.bestGuessLabels)) - throw TypeError(".google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.bestGuessLabels: object expected"); - message.bestGuessLabels[i] = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.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.v1p1beta1.WebDetection.WebLabel.toObject(message.bestGuessLabels[j], options); - } - return object; - }; - - /** - * Converts this WebDetection to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @instance - * @returns {Object.} JSON object - */ - WebDetection.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetection - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.WebDetection"; - }; - - WebDetection.WebEntity = (function() { - - /** - * Properties of a WebEntity. - * @memberof google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection - * @classdesc Represents a WebEntity. - * @implements IWebEntity - * @constructor - * @param {google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.entityId = ""; - - /** - * WebEntity score. - * @member {number} score - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.score = 0; - - /** - * WebEntity description. - * @member {string} description - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.description = ""; - - /** - * Creates a new WebEntity instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebEntity=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.WebEntity.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p1beta1.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 && Object.hasOwnProperty.call(message, "entityId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.entityId); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - return writer; - }; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebEntity.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebEntity} message WebEntity message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebEntity.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @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.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decode = function decode(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.WebDetection.WebEntity(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.entityId = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.description = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebEntity message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebEntity.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.entityId != null && message.hasOwnProperty("entityId")) - if (!$util.isString(message.entityId)) - return "entityId: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - return null; - }; - - /** - * Creates a WebEntity message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebEntity} WebEntity - */ - WebEntity.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.WebDetection.WebEntity) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.WebDetection.WebEntity(); - if (object.entityId != null) - message.entityId = String(object.entityId); - if (object.score != null) - message.score = Number(object.score); - if (object.description != null) - message.description = String(object.description); - return message; - }; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.WebEntity} message WebEntity - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebEntity.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.entityId = ""; - object.score = 0; - object.description = ""; - } - if (message.entityId != null && message.hasOwnProperty("entityId")) - object.entityId = message.entityId; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - return object; - }; - - /** - * Converts this WebEntity to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @instance - * @returns {Object.} JSON object - */ - WebEntity.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebEntity - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebEntity - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebEntity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.WebDetection.WebEntity"; - }; - - return WebEntity; - })(); - - WebDetection.WebImage = (function() { - - /** - * Properties of a WebImage. - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @interface IWebImage - * @property {string|null} [url] WebImage url - * @property {number|null} [score] WebImage score - */ - - /** - * Constructs a new WebImage. - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @classdesc Represents a WebImage. - * @implements IWebImage - * @constructor - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebImage=} [properties] Properties to set - */ - function WebImage(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]]; - } - - /** - * WebImage url. - * @member {string} url - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.url = ""; - - /** - * WebImage score. - * @member {number} score - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.score = 0; - - /** - * Creates a new WebImage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebImage} WebImage instance - */ - WebImage.create = function create(properties) { - return new WebImage(properties); - }; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebImage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - return writer; - }; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebImage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @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.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decode = function decode(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.WebDetection.WebImage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebImage message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebImage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - return null; - }; - - /** - * Creates a WebImage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebImage} WebImage - */ - WebImage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - return message; - }; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.WebImage} message WebImage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebImage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.url = ""; - object.score = 0; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - return object; - }; - - /** - * Converts this WebImage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @instance - * @returns {Object.} JSON object - */ - WebImage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebImage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebImage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebImage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.WebDetection.WebImage"; - }; - - return WebImage; - })(); - - WebDetection.WebPage = (function() { - - /** - * Properties of a WebPage. - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @interface IWebPage - * @property {string|null} [url] WebPage url - * @property {number|null} [score] WebPage score - * @property {string|null} [pageTitle] WebPage pageTitle - * @property {Array.|null} [fullMatchingImages] WebPage fullMatchingImages - * @property {Array.|null} [partialMatchingImages] WebPage partialMatchingImages - */ - - /** - * Constructs a new WebPage. - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @classdesc Represents a WebPage. - * @implements IWebPage - * @constructor - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebPage=} [properties] Properties to set - */ - function WebPage(properties) { - this.fullMatchingImages = []; - this.partialMatchingImages = []; - 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]]; - } - - /** - * WebPage url. - * @member {string} url - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.url = ""; - - /** - * WebPage score. - * @member {number} score - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.score = 0; - - /** - * WebPage pageTitle. - * @member {string} pageTitle - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.pageTitle = ""; - - /** - * WebPage fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebPage partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.partialMatchingImages = $util.emptyArray; - - /** - * Creates a new WebPage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebPage} WebPage instance - */ - WebPage.create = function create(properties) { - return new WebPage(properties); - }; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebPage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pageTitle != null && Object.hasOwnProperty.call(message, "pageTitle")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageTitle); - if (message.fullMatchingImages != null && message.fullMatchingImages.length) - for (var i = 0; i < message.fullMatchingImages.length; ++i) - $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.encode(message.fullMatchingImages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.partialMatchingImages != null && message.partialMatchingImages.length) - for (var i = 0; i < message.partialMatchingImages.length; ++i) - $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.encode(message.partialMatchingImages[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebPage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @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.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decode = function decode(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.WebDetection.WebPage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.pageTitle = reader.string(); - break; - } - case 4: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebPage message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebPage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - if (!$util.isString(message.pageTitle)) - return "pageTitle: string expected"; - 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.v1p1beta1.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.v1p1beta1.WebDetection.WebImage.verify(message.partialMatchingImages[i]); - if (error) - return "partialMatchingImages." + error; - } - } - return null; - }; - - /** - * Creates a WebPage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebPage} WebPage - */ - WebPage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.WebDetection.WebPage) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.WebDetection.WebPage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - if (object.pageTitle != null) - message.pageTitle = String(object.pageTitle); - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1p1beta1.WebDetection.WebPage.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.v1p1beta1.WebDetection.WebPage.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1p1beta1.WebDetection.WebPage.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.v1p1beta1.WebDetection.WebPage.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1p1beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.WebPage} message WebPage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebPage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.fullMatchingImages = []; - object.partialMatchingImages = []; - } - if (options.defaults) { - object.url = ""; - object.score = 0; - object.pageTitle = ""; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - object.pageTitle = message.pageTitle; - if (message.fullMatchingImages && message.fullMatchingImages.length) { - object.fullMatchingImages = []; - for (var j = 0; j < message.fullMatchingImages.length; ++j) - object.fullMatchingImages[j] = $root.google.cloud.vision.v1p1beta1.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.v1p1beta1.WebDetection.WebImage.toObject(message.partialMatchingImages[j], options); - } - return object; - }; - - /** - * Converts this WebPage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @instance - * @returns {Object.} JSON object - */ - WebPage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebPage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebPage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebPage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.WebDetection.WebPage"; - }; - - return WebPage; - })(); - - WebDetection.WebLabel = (function() { - - /** - * Properties of a WebLabel. - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @interface IWebLabel - * @property {string|null} [label] WebLabel label - * @property {string|null} [languageCode] WebLabel languageCode - */ - - /** - * Constructs a new WebLabel. - * @memberof google.cloud.vision.v1p1beta1.WebDetection - * @classdesc Represents a WebLabel. - * @implements IWebLabel - * @constructor - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebLabel=} [properties] Properties to set - */ - function WebLabel(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]]; - } - - /** - * WebLabel label. - * @member {string} label - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.label = ""; - - /** - * WebLabel languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.languageCode = ""; - - /** - * Creates a new WebLabel instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebLabel=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebLabel} WebLabel instance - */ - WebLabel.create = function create(properties) { - return new WebLabel(properties); - }; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebLabel.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.label); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - return writer; - }; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetection.WebLabel.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @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.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decode = function decode(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.WebDetection.WebLabel(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.label = reader.string(); - break; - } - case 2: { - message.languageCode = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebLabel message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebLabel.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.label != null && message.hasOwnProperty("label")) - if (!$util.isString(message.label)) - return "label: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - return null; - }; - - /** - * Creates a WebLabel message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.WebDetection.WebLabel} WebLabel - */ - WebLabel.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.WebDetection.WebLabel) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.WebDetection.WebLabel(); - if (object.label != null) - message.label = String(object.label); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - return message; - }; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p1beta1.WebDetection.WebLabel} message WebLabel - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebLabel.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - 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; - }; - - /** - * Converts this WebLabel to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @instance - * @returns {Object.} JSON object - */ - WebLabel.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebLabel - * @function getTypeUrl - * @memberof google.cloud.vision.v1p1beta1.WebDetection.WebLabel - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebLabel.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p1beta1.WebDetection.WebLabel"; - }; - - return WebLabel; - })(); - - return WebDetection; - })(); - - return v1p1beta1; - })(); - - vision.v1p2beta1 = (function() { - - /** - * Namespace v1p2beta1. - * @memberof google.cloud.vision - * @namespace - */ - var v1p2beta1 = {}; - - v1p2beta1.Vertex = (function() { - - /** - * Properties of a Vertex. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y - */ - - /** - * Constructs a new Vertex. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Vertex. - * @implements IVertex - * @constructor - * @param {google.cloud.vision.v1p2beta1.IVertex=} [properties] Properties to set - */ - 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]]; - } - - /** - * 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 - * @instance - */ - Vertex.prototype.y = 0; - - /** - * Creates a new Vertex instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.Vertex - * @static - * @param {google.cloud.vision.v1p2beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex instance - */ - Vertex.create = function create(properties) { - return new Vertex(properties); - }; - - /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.Vertex - * @static - * @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 - */ - Vertex.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); - return writer; - }; - - /** - * 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.Vertex - * @static - * @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 - */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Vertex message from the specified reader or buffer. - * @function decode - * @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.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.v1p2beta1.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; - }; - - /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Vertex - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Vertex.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Vertex message. - * @function verify - * @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 - */ - 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; - }; - - /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Vertex - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex - */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Vertex) - 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; - return message; - }; - - /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Vertex - * @static - * @param {google.cloud.vision.v1p2beta1.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.v1p2beta1.Vertex - * @instance - * @returns {Object.} JSON object - */ - Vertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Vertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Vertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Vertex"; - }; - - return Vertex; - })(); - - v1p2beta1.NormalizedVertex = (function() { - - /** - * Properties of a NormalizedVertex. - * @memberof google.cloud.vision.v1p2beta1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y - */ - - /** - * Constructs a new NormalizedVertex. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex - * @constructor - * @param {google.cloud.vision.v1p2beta1.INormalizedVertex=} [properties] Properties to set - */ - function NormalizedVertex(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]]; - } - - /** - * 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 - * @instance - */ - NormalizedVertex.prototype.y = 0; - - /** - * Creates a new NormalizedVertex instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex - * @static - * @param {google.cloud.vision.v1p2beta1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex instance - */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); - }; - - /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex - * @static - * @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 - */ - NormalizedVertex.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - return writer; - }; - - /** - * 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.NormalizedVertex - * @static - * @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 - */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer. - * @function decode - * @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.NormalizedVertex} NormalizedVertex - * @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) { - 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(); - 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; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NormalizedVertex message. - * @function verify - * @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 - */ - NormalizedVertex.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"; - return null; - }; - - /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex - */ - NormalizedVertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.NormalizedVertex) - 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); - return message; - }; - - /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex - * @static - * @param {google.cloud.vision.v1p2beta1.NormalizedVertex} message NormalizedVertex - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NormalizedVertex.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; - return object; - }; - - /** - * Converts this NormalizedVertex to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex - * @instance - * @returns {Object.} JSON object - */ - NormalizedVertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NormalizedVertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NormalizedVertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.NormalizedVertex"; - }; - - return NormalizedVertex; - })(); - - v1p2beta1.BoundingPoly = (function() { - - /** - * Properties of a BoundingPoly. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices - */ - - /** - * Constructs a new BoundingPoly. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly - * @constructor - * @param {google.cloud.vision.v1p2beta1.IBoundingPoly=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @instance - */ - BoundingPoly.prototype.vertices = $util.emptyArray; - - /** - * BoundingPoly normalizedVertices. - * @member {Array.} normalizedVertices - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @instance - */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @static - * @param {google.cloud.vision.v1p2beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly instance - */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); - }; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @static - * @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 - */ - BoundingPoly.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(); - return writer; - }; - - /** - * 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.BoundingPoly - * @static - * @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 - */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @function decode - * @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.BoundingPoly} BoundingPoly - * @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) { - 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(); - 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())); - break; - } - case 2: { - 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); - break; - } - } - return message; - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BoundingPoly message. - * @function verify - * @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 - */ - BoundingPoly.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; - } - } - return null; - }; - - /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly - */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.BoundingPoly) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @static - * @param {google.cloud.vision.v1p2beta1.BoundingPoly} message BoundingPoly - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoundingPoly.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); - } - return object; - }; - - /** - * Converts this BoundingPoly to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @instance - * @returns {Object.} JSON object - */ - BoundingPoly.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BoundingPoly - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.BoundingPoly"; - }; - - return BoundingPoly; - })(); - - v1p2beta1.Position = (function() { - - /** - * Properties of a Position. - * @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 - */ - - /** - * Constructs a new Position. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Position. - * @implements IPosition - * @constructor - * @param {google.cloud.vision.v1p2beta1.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]]; - } - - /** - * 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 - * @instance - */ - Position.prototype.y = 0; - - /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1p2beta1.Position - * @instance - */ - Position.prototype.z = 0; - - /** - * Creates a new Position instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.Position - * @static - * @param {google.cloud.vision.v1p2beta1.IPosition=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Position} Position instance - */ - Position.create = function create(properties) { - return new Position(properties); - }; - - /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.Position - * @static - * @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 - */ - Position.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && Object.hasOwnProperty.call(message, "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.v1p2beta1.Position.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Position - * @static - * @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 - */ - 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.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.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.v1p2beta1.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; - }; - - /** - * Decodes a Position message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Position - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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.v1p2beta1.Position - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Position} Position - */ - Position.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Position) - 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); - return message; - }; - - /** - * Creates a plain object from a Position message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Position - * @static - * @param {google.cloud.vision.v1p2beta1.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.v1p2beta1.Position - * @instance - * @returns {Object.} JSON object - */ - Position.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Position - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Position - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Position.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Position"; - }; - - return Position; - })(); - - 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() { - - /** - * Properties of a Feature. - * @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 - */ - - /** - * Constructs a new Feature. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Feature. - * @implements IFeature - * @constructor - * @param {google.cloud.vision.v1p2beta1.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.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 - * @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.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Feature} Feature instance - */ - Feature.create = function create(properties) { - return new Feature(properties); - }; - - /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Feature.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.Feature - * @static - * @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 - */ - Feature.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && Object.hasOwnProperty.call(message, "model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); - return writer; - }; - - /** - * 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.Feature - * @static - * @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 - */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Feature message from the specified reader or buffer. - * @function decode - * @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.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.v1p2beta1.Feature(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type = reader.int32(); - break; - } - case 2: { - message.maxResults = reader.int32(); - break; - } - case 3: { - message.model = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Feature - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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: - 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 Feature message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Feature - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Feature} Feature - */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Feature) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.Feature(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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 Feature message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Feature - * @static - * @param {google.cloud.vision.v1p2beta1.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.v1p2beta1.Feature.Type[message.type] === undefined ? message.type : $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 Feature to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Feature - * @instance - * @returns {Object.} JSON object - */ - Feature.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Feature - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Feature - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Feature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Feature"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p2beta1.Feature.Type - * @enum {number} - * @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.ImageSource = (function() { - - /** - * Properties of an ImageSource. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri - */ - - /** - * Constructs a new ImageSource. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageSource. - * @implements IImageSource - * @constructor - * @param {google.cloud.vision.v1p2beta1.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]]; - } - - /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @instance - */ - ImageSource.prototype.gcsImageUri = ""; - - /** - * ImageSource imageUri. - * @member {string} imageUri - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @instance - */ - ImageSource.prototype.imageUri = ""; - - /** - * Creates a new ImageSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @static - * @param {google.cloud.vision.v1p2beta1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource instance - */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); - }; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @static - * @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 - */ - ImageSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsImageUri != null && Object.hasOwnProperty.call(message, "gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); - return writer; - }; - - /** - * 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.ImageSource - * @static - * @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 - */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer. - * @function decode - * @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.ImageSource} ImageSource - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsImageUri = reader.string(); - break; - } - case 2: { - message.imageUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageSource message. - * @function verify - * @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 - */ - ImageSource.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"; - return null; - }; - - /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource - */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageSource) - 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); - return message; - }; - - /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @static - * @param {google.cloud.vision.v1p2beta1.ImageSource} message ImageSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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 ImageSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @instance - * @returns {Object.} JSON object - */ - ImageSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.ImageSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.ImageSource"; - }; - - return ImageSource; - })(); - - v1p2beta1.Image = (function() { - - /** - * Properties of an Image. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1p2beta1.IImageSource|null} [source] Image source - */ - - /** - * Constructs a new Image. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an Image. - * @implements IImage - * @constructor - * @param {google.cloud.vision.v1p2beta1.IImage=} [properties] Properties to set - */ - function Image(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]]; - } - - /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1p2beta1.Image - * @instance - */ - Image.prototype.content = $util.newBuffer([]); - - /** - * Image source. - * @member {google.cloud.vision.v1p2beta1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1p2beta1.Image - * @instance - */ - Image.prototype.source = null; - - /** - * 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 - */ - Image.create = function create(properties) { - return new Image(properties); - }; - - /** - * 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 - */ - Image.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && Object.hasOwnProperty.call(message, "source")) - $root.google.cloud.vision.v1p2beta1.ImageSource.encode(message.source, 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. - * @function encodeDelimited - * @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 - */ - Image.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Image message from the specified reader or buffer. - * @function decode - * @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.Image} Image - * @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) { - 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(); - 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.v1p2beta1.ImageSource.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Image - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Image.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Image message. - * @function verify - * @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 - */ - Image.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; - } - return null; - }; - - /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Image - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Image} Image - */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Image) - 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 >= 0) - 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 Image message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Image - * @static - * @param {google.cloud.vision.v1p2beta1.Image} message Image - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Image.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 (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. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Image - * @instance - * @returns {Object.} JSON object - */ - Image.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Image - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Image - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Image.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Image"; - }; - - return Image; - })(); - - v1p2beta1.FaceAnnotation = (function() { - - /** - * Properties of a FaceAnnotation. - * @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 - */ - - /** - * Constructs a new FaceAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation - * @constructor - * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * 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 - * @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 && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && Object.hasOwnProperty.call(message, "panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && Object.hasOwnProperty.call(message, "tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && Object.hasOwnProperty.call(message, "detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && Object.hasOwnProperty.call(message, "landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && Object.hasOwnProperty.call(message, "joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && Object.hasOwnProperty.call(message, "sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && Object.hasOwnProperty.call(message, "angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && Object.hasOwnProperty.call(message, "surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && Object.hasOwnProperty.call(message, "underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && Object.hasOwnProperty.call(message, "blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && Object.hasOwnProperty.call(message, "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.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; - } - return null; - }; - - /** - * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation - */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.FaceAnnotation) - 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) { - default: - if (typeof object.joyLikelihood === "number") { - message.joyLikelihood = object.joyLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.sorrowLikelihood === "number") { - message.sorrowLikelihood = object.sorrowLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.angerLikelihood === "number") { - message.angerLikelihood = object.angerLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.surpriseLikelihood === "number") { - message.surpriseLikelihood = object.surpriseLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.underExposedLikelihood === "number") { - message.underExposedLikelihood = object.underExposedLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.blurredLikelihood === "number") { - message.blurredLikelihood = object.blurredLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.headwearLikelihood === "number") { - message.headwearLikelihood = object.headwearLikelihood; - break; - } - break; - 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 FaceAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.FaceAnnotation} message FaceAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FaceAnnotation.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); - } - 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] === undefined ? message.joyLikelihood : $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] === undefined ? message.sorrowLikelihood : $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] === undefined ? message.angerLikelihood : $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] === undefined ? message.surpriseLikelihood : $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] === undefined ? message.underExposedLikelihood : $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] === undefined ? message.blurredLikelihood : $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] === undefined ? message.headwearLikelihood : $root.google.cloud.vision.v1p2beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; - return object; - }; - - /** - * Converts this FaceAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - * @returns {Object.} JSON object - */ - FaceAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FaceAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FaceAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.FaceAnnotation"; - }; - - FaceAnnotation.Landmark = (function() { - - /** - * 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 - */ - - /** - * 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]]; - } - - /** - * Landmark type. - * @member {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 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 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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && Object.hasOwnProperty.call(message, "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; - }; - - /** - * 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) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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] === undefined ? message.type : $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; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for Landmark - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Landmark.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type - * @enum {number} - * @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; - })(); - - v1p2beta1.LocationInfo = (function() { - - /** - * Properties of a LocationInfo. - * @memberof google.cloud.vision.v1p2beta1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng - */ - - /** - * Constructs a new LocationInfo. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a LocationInfo. - * @implements ILocationInfo - * @constructor - * @param {google.cloud.vision.v1p2beta1.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.v1p2beta1.LocationInfo - * @instance - */ - LocationInfo.prototype.latLng = null; - - /** - * Creates a new LocationInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p2beta1.ILocationInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo instance - */ - LocationInfo.create = function create(properties) { - return new LocationInfo(properties); - }; - - /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p2beta1.LocationInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.LocationInfo - * @static - * @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 - */ - LocationInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLng != null && Object.hasOwnProperty.call(message, "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.v1p2beta1.LocationInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.LocationInfo - * @static - * @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 - */ - 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.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.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.v1p2beta1.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.v1p2beta1.LocationInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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.v1p2beta1.LocationInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo - */ - LocationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.LocationInfo) - 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); - } - return message; - }; - - /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p2beta1.LocationInfo} message LocationInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LocationInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.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.v1p2beta1.LocationInfo - * @instance - * @returns {Object.} JSON object - */ - LocationInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocationInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.LocationInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.LocationInfo"; - }; - - return LocationInfo; - })(); - - v1p2beta1.Property = (function() { - - /** - * Properties of a Property. - * @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 - */ - - /** - * Constructs a new Property. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Property. - * @implements IProperty - * @constructor - * @param {google.cloud.vision.v1p2beta1.IProperty=} [properties] Properties to set - */ - function Property(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1p2beta1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * 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.Property - * @static - * @param {google.cloud.vision.v1p2beta1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Property} Property instance - */ - Property.create = function create(properties) { - return new Property(properties); - }; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Property.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.Property - * @static - * @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 - */ - Property.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && Object.hasOwnProperty.call(message, "uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); - return writer; - }; - - /** - * 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.Property - * @static - * @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 - */ - Property.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Property message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.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.Property} Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Property.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Property(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - case 3: { - message.uint64Value = reader.uint64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Property - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Property.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Property message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.Property - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Property.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.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 Property message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Property - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Property} Property - */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Property) - 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); - return message; - }; - - /** - * Creates a plain object from a Property message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Property - * @static - * @param {google.cloud.vision.v1p2beta1.Property} message Property - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Property.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.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 Property to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Property - * @instance - * @returns {Object.} JSON object - */ - Property.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Property - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Property - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Property"; - }; - - return Property; - })(); - - v1p2beta1.EntityAnnotation = (function() { - - /** - * Properties of an EntityAnnotation. - * @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 - */ - - /** - * Constructs a new EntityAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation - * @constructor - * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.mid = ""; - - /** - * 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.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) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && Object.hasOwnProperty.call(message, "locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && Object.hasOwnProperty.call(message, "topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "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 EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.EntityAnnotation.verify|verify} messages. - * @function encodeDelimited - * @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.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer. - * @function decode - * @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.EntityAnnotation} EntityAnnotation - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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.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); - break; - } - } - return message; - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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.v1p2beta1.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.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 an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation - */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.EntityAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.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.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 EntityAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance - * @returns {Object.} JSON object - */ - EntityAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EntityAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EntityAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.EntityAnnotation"; - }; - - return EntityAnnotation; - })(); - - v1p2beta1.SafeSearchAnnotation = (function() { - - /** - * Properties of a SafeSearchAnnotation. - * @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 - */ - - /** - * Constructs a new SafeSearchAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation - * @constructor - * @param {google.cloud.vision.v1p2beta1.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.v1p2beta1.Likelihood} adult - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.adult = 0; - - /** - * 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.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation instance - */ - SafeSearchAnnotation.create = function create(properties) { - return new SafeSearchAnnotation(properties); - }; - - /** - * 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 - */ - SafeSearchAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.adult != null && Object.hasOwnProperty.call(message, "adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && Object.hasOwnProperty.call(message, "spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && Object.hasOwnProperty.call(message, "medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && Object.hasOwnProperty.call(message, "violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && Object.hasOwnProperty.call(message, "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.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 - */ - 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.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 - */ - 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; - }; - - /** - * 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 - */ - 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.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) - 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.v1p2beta1.SafeSearchAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation - */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation(); - switch (object.adult) { - default: - if (typeof object.adult === "number") { - message.adult = object.adult; - break; - } - break; - 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) { - default: - if (typeof object.spoof === "number") { - message.spoof = object.spoof; - break; - } - break; - 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) { - default: - if (typeof object.medical === "number") { - message.medical = object.medical; - break; - } - break; - 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) { - default: - if (typeof object.violence === "number") { - message.violence = object.violence; - break; - } - break; - 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) { - default: - if (typeof object.racy === "number") { - message.racy = object.racy; - break; - } - break; - 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 SafeSearchAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} message SafeSearchAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SafeSearchAnnotation.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.v1p2beta1.Likelihood[message.adult] === undefined ? message.adult : $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] === undefined ? message.spoof : $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] === undefined ? message.medical : $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] === undefined ? message.violence : $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] === undefined ? message.racy : $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); - }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SafeSearchAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.SafeSearchAnnotation"; - }; - - 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 && Object.hasOwnProperty.call(message, "minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && Object.hasOwnProperty.call(message, "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.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. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @instance - * @returns {Object.} JSON object - */ - LatLongRect.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LatLongRect - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LatLongRect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.LatLongRect"; - }; - - 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 - */ - - /** - * 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]]; - } - - /** - * ColorInfo color. - * @member {google.type.IColor|null|undefined} color - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @instance - */ - ColorInfo.prototype.color = null; - - /** - * 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.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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && Object.hasOwnProperty.call(message, "pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); - 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(); - }; - - /** - * 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; - } - } - 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()); - }; - - /** - * 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; - }; - - /** - * 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) - 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 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); - }; - - /** - * Gets the default type url for ColorInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.ColorInfo"; - }; - - return ColorInfo; - })(); - - v1p2beta1.DominantColorsAnnotation = (function() { - - /** - * Properties of a DominantColorsAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors - */ - - /** - * Constructs a new DominantColorsAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation - * @constructor - * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation=} [properties] Properties to set - */ - function DominantColorsAnnotation(properties) { - this.colors = []; - 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]]; - } - - /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @instance - */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation instance - */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); - }; - - /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.DominantColorsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @static - * @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 - */ - 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.v1p2beta1.ColorInfo.encode(message.colors[i], 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. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @static - * @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 - */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. - * @function decode - * @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.DominantColorsAnnotation} DominantColorsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DominantColorsAnnotation message. - * @function verify - * @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 - */ - DominantColorsAnnotation.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; - }; - - /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation - */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} message DominantColorsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DominantColorsAnnotation.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); - } - return object; - }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @instance - * @returns {Object.} JSON object - */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DominantColorsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.DominantColorsAnnotation"; - }; - - return DominantColorsAnnotation; - })(); - - v1p2beta1.ImageProperties = (function() { - - /** - * Properties of an ImageProperties. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IImageProperties - * @property {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors - */ - - /** - * Constructs a new ImageProperties. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties - * @constructor - * @param {google.cloud.vision.v1p2beta1.IImageProperties=} [properties] Properties to set - */ - 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]]; - } - - /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1p2beta1.ImageProperties - * @instance - */ - ImageProperties.prototype.dominantColors = null; - - /** - * Creates a new ImageProperties instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.ImageProperties - * @static - * @param {google.cloud.vision.v1p2beta1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties instance - */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); - }; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageProperties.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.ImageProperties - * @static - * @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 - */ - ImageProperties.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dominantColors != null && Object.hasOwnProperty.call(message, "dominantColors")) - $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageProperties - * @static - * @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 - */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer. - * @function decode - * @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.ImageProperties} ImageProperties - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageProperties - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageProperties message. - * @function verify - * @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 - */ - ImageProperties.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; - } - return null; - }; - - /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ImageProperties - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties - */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageProperties) - 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); - } - return message; - }; - - /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.ImageProperties - * @static - * @param {google.cloud.vision.v1p2beta1.ImageProperties} message ImageProperties - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageProperties.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); - return object; - }; - - /** - * Converts this ImageProperties to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ImageProperties - * @instance - * @returns {Object.} JSON object - */ - ImageProperties.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageProperties - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.ImageProperties - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.ImageProperties"; - }; - - return ImageProperties; - })(); - - v1p2beta1.CropHint = (function() { - - /** - * Properties of a CropHint. - * @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 - */ - - /** - * Constructs a new CropHint. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a CropHint. - * @implements ICropHint - * @constructor - * @param {google.cloud.vision.v1p2beta1.ICropHint=} [properties] Properties to set - */ - function CropHint(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]]; - } - - /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p2beta1.CropHint - * @instance - */ - CropHint.prototype.boundingPoly = null; - - /** - * CropHint confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.CropHint - * @instance - */ - CropHint.prototype.confidence = 0; - - /** - * 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.CropHint - * @static - * @param {google.cloud.vision.v1p2beta1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint instance - */ - CropHint.create = function create(properties) { - return new CropHint(properties); - }; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHint.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.CropHint - * @static - * @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 - */ - CropHint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && Object.hasOwnProperty.call(message, "importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); - return writer; - }; - - /** - * 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.CropHint - * @static - * @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 - */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHint message from the specified reader or buffer. - * @function decode - * @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.CropHint} CropHint - * @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) { - 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(); - 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.confidence = reader.float(); - break; - } - case 3: { - message.importanceFraction = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHint message. - * @function verify - * @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 - */ - CropHint.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.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. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.CropHint - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint - */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHint) - 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); - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.CropHint - * @static - * @param {google.cloud.vision.v1p2beta1.CropHint} message CropHint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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.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 CropHint to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.CropHint - * @instance - * @returns {Object.} JSON object - */ - CropHint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHint - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.CropHint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.CropHint"; - }; - - return CropHint; - })(); - - v1p2beta1.CropHintsAnnotation = (function() { - - /** - * Properties of a CropHintsAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints - */ - - /** - * Constructs a new CropHintsAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation - * @constructor - * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation - * @instance - */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation instance - */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); - }; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.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(); - return writer; - }; - - /** - * 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.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. - * @function decode - * @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.CropHintsAnnotation} CropHintsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsAnnotation message. - * @function verify - * @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 - */ - CropHintsAnnotation.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; - } - } - return null; - }; - - /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation - */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.CropHintsAnnotation} message CropHintsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsAnnotation.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); - } - return object; - }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation - * @instance - * @returns {Object.} JSON object - */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.CropHintsAnnotation"; - }; - - return CropHintsAnnotation; - })(); - - v1p2beta1.CropHintsParams = (function() { - - /** - * Properties of a CropHintsParams. - * @memberof google.cloud.vision.v1p2beta1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios - */ - - /** - * Constructs a new CropHintsParams. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams - * @constructor - * @param {google.cloud.vision.v1p2beta1.ICropHintsParams=} [properties] Properties to set - */ - function CropHintsParams(properties) { - this.aspectRatios = []; - 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]]; - } - - /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams - * @instance - */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams - * @static - * @param {google.cloud.vision.v1p2beta1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams instance - */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); - }; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams - * @static - * @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 - */ - CropHintsParams.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(); - } - return writer; - }; - - /** - * 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.CropHintsParams - * @static - * @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 - */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer. - * @function decode - * @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.CropHintsParams} CropHintsParams - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsParams message. - * @function verify - * @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 - */ - CropHintsParams.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"; - } - return null; - }; - - /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams - */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHintsParams) - 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]); - } - return message; - }; - - /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams - * @static - * @param {google.cloud.vision.v1p2beta1.CropHintsParams} message CropHintsParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsParams.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]; - } - return object; - }; - - /** - * Converts this CropHintsParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams - * @instance - * @returns {Object.} JSON object - */ - CropHintsParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.CropHintsParams"; - }; - - return CropHintsParams; - })(); - - v1p2beta1.WebDetectionParams = (function() { - - /** - * Properties of a WebDetectionParams. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults - */ - - /** - * Constructs a new WebDetectionParams. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams - * @constructor - * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams=} [properties] Properties to set - */ - function WebDetectionParams(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]]; - } - - /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams - * @instance - */ - WebDetectionParams.prototype.includeGeoResults = false; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams instance - */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); - }; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.includeGeoResults != null && Object.hasOwnProperty.call(message, "includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); - return writer; - }; - - /** - * 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.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer. - * @function decode - * @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.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.v1p2beta1.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.v1p2beta1.WebDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams - */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetectionParams) - return object; - 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 WebDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetectionParams} message WebDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebDetectionParams.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; - return object; - }; - - /** - * Converts this WebDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams - * @instance - * @returns {Object.} JSON object - */ - WebDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.WebDetectionParams"; - }; - - return WebDetectionParams; - })(); - - v1p2beta1.TextDetectionParams = (function() { - - /** - * Properties of a TextDetectionParams. - * @memberof google.cloud.vision.v1p2beta1 - * @interface ITextDetectionParams - * @property {boolean|null} [enableTextDetectionConfidenceScore] TextDetectionParams enableTextDetectionConfidenceScore - * @property {Array.|null} [advancedOcrOptions] TextDetectionParams advancedOcrOptions - */ - - /** - * Constructs a new TextDetectionParams. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a TextDetectionParams. - * @implements ITextDetectionParams - * @constructor - * @param {google.cloud.vision.v1p2beta1.ITextDetectionParams=} [properties] Properties to set - */ - function TextDetectionParams(properties) { - this.advancedOcrOptions = []; - 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]]; - } - - /** - * TextDetectionParams enableTextDetectionConfidenceScore. - * @member {boolean} enableTextDetectionConfidenceScore - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.enableTextDetectionConfidenceScore = false; - - /** - * TextDetectionParams advancedOcrOptions. - * @member {Array.} advancedOcrOptions - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.advancedOcrOptions = $util.emptyArray; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p2beta1.ITextDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.TextDetectionParams} TextDetectionParams instance - */ - TextDetectionParams.create = function create(properties) { - return new TextDetectionParams(properties); - }; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p2beta1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enableTextDetectionConfidenceScore != null && Object.hasOwnProperty.call(message, "enableTextDetectionConfidenceScore")) - writer.uint32(/* id 9, wireType 0 =*/72).bool(message.enableTextDetectionConfidenceScore); - if (message.advancedOcrOptions != null && message.advancedOcrOptions.length) - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.advancedOcrOptions[i]); - return writer; - }; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextDetectionParams.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p2beta1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @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.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decode = function decode(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.TextDetectionParams(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 9: { - message.enableTextDetectionConfidenceScore = reader.bool(); - break; - } - case 11: { - if (!(message.advancedOcrOptions && message.advancedOcrOptions.length)) - message.advancedOcrOptions = []; - message.advancedOcrOptions.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TextDetectionParams message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TextDetectionParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - if (typeof message.enableTextDetectionConfidenceScore !== "boolean") - return "enableTextDetectionConfidenceScore: boolean expected"; - if (message.advancedOcrOptions != null && message.hasOwnProperty("advancedOcrOptions")) { - if (!Array.isArray(message.advancedOcrOptions)) - return "advancedOcrOptions: array expected"; - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - if (!$util.isString(message.advancedOcrOptions[i])) - return "advancedOcrOptions: string[] expected"; - } - return null; - }; - - /** - * Creates a TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.TextDetectionParams} TextDetectionParams - */ - TextDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.TextDetectionParams) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.TextDetectionParams(); - if (object.enableTextDetectionConfidenceScore != null) - message.enableTextDetectionConfidenceScore = Boolean(object.enableTextDetectionConfidenceScore); - if (object.advancedOcrOptions) { - if (!Array.isArray(object.advancedOcrOptions)) - throw TypeError(".google.cloud.vision.v1p2beta1.TextDetectionParams.advancedOcrOptions: array expected"); - message.advancedOcrOptions = []; - for (var i = 0; i < object.advancedOcrOptions.length; ++i) - message.advancedOcrOptions[i] = String(object.advancedOcrOptions[i]); - } - return message; - }; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p2beta1.TextDetectionParams} message TextDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TextDetectionParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.advancedOcrOptions = []; - if (options.defaults) - object.enableTextDetectionConfidenceScore = false; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - object.enableTextDetectionConfidenceScore = message.enableTextDetectionConfidenceScore; - if (message.advancedOcrOptions && message.advancedOcrOptions.length) { - object.advancedOcrOptions = []; - for (var j = 0; j < message.advancedOcrOptions.length; ++j) - object.advancedOcrOptions[j] = message.advancedOcrOptions[j]; - } - return object; - }; - - /** - * Converts this TextDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @instance - * @returns {Object.} JSON object - */ - TextDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.TextDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.TextDetectionParams"; - }; - - return TextDetectionParams; - })(); - - v1p2beta1.ImageContext = (function() { - - /** - * Properties of an ImageContext. - * @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 - * @property {google.cloud.vision.v1p2beta1.ITextDetectionParams|null} [textDetectionParams] ImageContext textDetectionParams - */ - - /** - * Constructs a new ImageContext. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageContext. - * @implements IImageContext - * @constructor - * @param {google.cloud.vision.v1p2beta1.IImageContext=} [properties] Properties to set - */ - function ImageContext(properties) { - this.languageHints = []; - 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]]; - } - - /** - * 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 - * @instance - */ - ImageContext.prototype.webDetectionParams = null; - - /** - * ImageContext textDetectionParams. - * @member {google.cloud.vision.v1p2beta1.ITextDetectionParams|null|undefined} textDetectionParams - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @instance - */ - ImageContext.prototype.textDetectionParams = null; - - /** - * Creates a new ImageContext instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @static - * @param {google.cloud.vision.v1p2beta1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext instance - */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); - }; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @static - * @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 - */ - ImageContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLongRect != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "cropHintsParams")) - $root.google.cloud.vision.v1p2beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.webDetectionParams != null && Object.hasOwnProperty.call(message, "webDetectionParams")) - $root.google.cloud.vision.v1p2beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.textDetectionParams != null && Object.hasOwnProperty.call(message, "textDetectionParams")) - $root.google.cloud.vision.v1p2beta1.TextDetectionParams.encode(message.textDetectionParams, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageContext - * @static - * @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 - */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer. - * @function decode - * @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.ImageContext} ImageContext - * @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) { - 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(); - 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()); - break; - } - case 12: { - message.textDetectionParams = $root.google.cloud.vision.v1p2beta1.TextDetectionParams.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageContext message. - * @function verify - * @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 - */ - ImageContext.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.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) { - var error = $root.google.cloud.vision.v1p2beta1.TextDetectionParams.verify(message.textDetectionParams); - if (error) - return "textDetectionParams." + error; - } - return null; - }; - - /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext - */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageContext) - 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); - } - if (object.textDetectionParams != null) { - if (typeof object.textDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.textDetectionParams: object expected"); - message.textDetectionParams = $root.google.cloud.vision.v1p2beta1.TextDetectionParams.fromObject(object.textDetectionParams); - } - 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 - */ - ImageContext.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; - object.textDetectionParams = 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); - if (message.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) - object.textDetectionParams = $root.google.cloud.vision.v1p2beta1.TextDetectionParams.toObject(message.textDetectionParams, options); - return object; - }; - - /** - * Converts this ImageContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @instance - * @returns {Object.} JSON object - */ - ImageContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.ImageContext"; - }; - - return ImageContext; - })(); - - v1p2beta1.AnnotateImageRequest = (function() { - - /** - * Properties of an AnnotateImageRequest. - * @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 - */ - - /** - * Constructs a new AnnotateImageRequest. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest - * @constructor - * @param {google.cloud.vision.v1p2beta1.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.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 - * @instance - */ - AnnotateImageRequest.prototype.imageContext = null; - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest instance - */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); - }; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.image != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1p2beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. - * @function decode - * @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.AnnotateImageRequest} AnnotateImageRequest - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateImageRequest message. - * @function verify - * @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 - */ - AnnotateImageRequest.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 (error) - return "imageContext." + error; - } - return null; - }; - - /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest - */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1p2beta1.AnnotateImageRequest} message AnnotateImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateImageRequest.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); - return object; - }; - - /** - * Converts this AnnotateImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.AnnotateImageRequest"; - }; - - return AnnotateImageRequest; - })(); - - v1p2beta1.ImageAnnotationContext = (function() { - - /** - * Properties of an ImageAnnotationContext. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IImageAnnotationContext - * @property {string|null} [uri] ImageAnnotationContext uri - * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber - */ - - /** - * Constructs a new ImageAnnotationContext. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageAnnotationContext. - * @implements IImageAnnotationContext - * @constructor - * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext=} [properties] Properties to set - */ - function ImageAnnotationContext(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]]; - } - - /** - * ImageAnnotationContext uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext - * @instance - */ - ImageAnnotationContext.prototype.uri = ""; - - /** - * 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.ImageAnnotationContext - * @static - * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext instance - */ - ImageAnnotationContext.create = function create(properties) { - return new ImageAnnotationContext(properties); - }; - - /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageAnnotationContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext - * @static - * @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 - */ - ImageAnnotationContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); - return writer; - }; - - /** - * 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.ImageAnnotationContext - * @static - * @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 - */ - ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. - * @function decode - * @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.ImageAnnotationContext} ImageAnnotationContext - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } - case 2: { - message.pageNumber = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageAnnotationContext message. - * @function verify - * @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 - */ - ImageAnnotationContext.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"; - return null; - }; - - /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext - */ - ImageAnnotationContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext) - 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; - return message; - }; - - /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext - * @static - * @param {google.cloud.vision.v1p2beta1.ImageAnnotationContext} message ImageAnnotationContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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 ImageAnnotationContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext - * @instance - * @returns {Object.} JSON object - */ - ImageAnnotationContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageAnnotationContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageAnnotationContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.ImageAnnotationContext"; - }; - - return ImageAnnotationContext; - })(); - - v1p2beta1.AnnotateImageResponse = (function() { - - /** - * Properties of an AnnotateImageResponse. - * @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 - */ - - /** - * Constructs a new AnnotateImageResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse - * @constructor - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AnnotateImageResponse faceAnnotations. - * @member {Array.} faceAnnotations - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.faceAnnotations = $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. - * @function create - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse instance - */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); - }; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.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 && Object.hasOwnProperty.call(message, "safeSearchAnnotation")) - $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && Object.hasOwnProperty.call(message, "imagePropertiesAnnotation")) - $root.google.cloud.vision.v1p2beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && Object.hasOwnProperty.call(message, "cropHintsAnnotation")) - $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && Object.hasOwnProperty.call(message, "fullTextAnnotation")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && Object.hasOwnProperty.call(message, "webDetection")) - $root.google.cloud.vision.v1p2beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.context != null && Object.hasOwnProperty.call(message, "context")) - $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. - * @function decode - * @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.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.v1p2beta1.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.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); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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.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 (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 AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse - */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse) - 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]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1p2beta1.AnnotateImageResponse} message AnnotateImageResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.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); - }; - - /** - * Gets the default type url for AnnotateImageResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.AnnotateImageResponse"; - }; - - return AnnotateImageResponse; - })(); - - v1p2beta1.AnnotateFileResponse = (function() { - - /** - * Properties of an AnnotateFileResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IAnnotateFileResponse - * @property {google.cloud.vision.v1p2beta1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig - * @property {Array.|null} [responses] AnnotateFileResponse responses - */ - - /** - * Constructs a new AnnotateFileResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AnnotateFileResponse. - * @implements IAnnotateFileResponse - * @constructor - * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse=} [properties] Properties to set - */ - 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]]; - } - - /** - * AnnotateFileResponse inputConfig. - * @member {google.cloud.vision.v1p2beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @instance - */ - AnnotateFileResponse.prototype.inputConfig = null; - - /** - * 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. - * @function create - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse instance - */ - AnnotateFileResponse.create = function create(properties) { - return new AnnotateFileResponse(properties); - }; - - /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateFileResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @static - * @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 - */ - AnnotateFileResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateFileResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @static - * @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 - */ - AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. - * @function decode - * @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.AnnotateFileResponse} AnnotateFileResponse - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateFileResponse message. - * @function verify - * @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 - */ - AnnotateFileResponse.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; - } - } - return null; - }; - - /** - * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse - */ - AnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateFileResponse) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p2beta1.AnnotateFileResponse} message AnnotateFileResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateFileResponse.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); - } - return object; - }; - - /** - * Converts this AnnotateFileResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @instance - * @returns {Object.} JSON object - */ - AnnotateFileResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateFileResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateFileResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.AnnotateFileResponse"; - }; - - return AnnotateFileResponse; - })(); - - v1p2beta1.BatchAnnotateImagesRequest = (function() { - - /** - * Properties of a BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests - */ - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest - * @constructor - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest - * @instance - */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance - */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest - * @static - * @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 - */ - 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.v1p2beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.BatchAnnotateImagesRequest - * @static - * @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 - */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateImagesRequest message. - * @function verify - * @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 - */ - 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.v1p2beta1.AnnotateImageRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } - return null; - }; - - /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchAnnotateImagesRequest.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); - } - return object; - }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest"; - }; - - return BatchAnnotateImagesRequest; - })(); - - v1p2beta1.BatchAnnotateImagesResponse = (function() { - - /** - * Properties of a BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses - */ - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse - * @constructor - * @param {google.cloud.vision.v1p2beta1.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]]; - } - - /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse - * @instance - */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance - */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse - * @static - * @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 - */ - 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.v1p2beta1.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.v1p2beta1.BatchAnnotateImagesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse - * @static - * @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 - */ - 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.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.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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.BatchAnnotateImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.BatchAnnotateImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse - */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse) - 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]); - } - } - 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 - * @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.v1p2beta1.AnnotateImageResponse.toObject(message.responses[j], options); - } - return object; - }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse"; - }; - - return BatchAnnotateImagesResponse; - })(); - - v1p2beta1.AsyncAnnotateFileRequest = (function() { - - /** - * Properties of an AsyncAnnotateFileRequest. - * @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 - */ - - /** - * Constructs a new AsyncAnnotateFileRequest. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AsyncAnnotateFileRequest. - * @implements IAsyncAnnotateFileRequest - * @constructor - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set - */ - 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]]; - } - - /** - * AsyncAnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1p2beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.inputConfig = null; - - /** - * 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.AsyncAnnotateFileRequest - * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance - */ - AsyncAnnotateFileRequest.create = function create(properties) { - return new AsyncAnnotateFileRequest(properties); - }; - - /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @static - * @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 - */ - AsyncAnnotateFileRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1p2beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "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. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @static - * @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 - */ - AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest - * @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) { - 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(); - 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.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); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncAnnotateFileRequest message. - * @function verify - * @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 - */ - AsyncAnnotateFileRequest.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.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 an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest - */ - AsyncAnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest) - 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); - } - 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 an AsyncAnnotateFileRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @static - * @param {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncAnnotateFileRequest.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.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 AsyncAnnotateFileRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncAnnotateFileRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncAnnotateFileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest"; - }; - - return AsyncAnnotateFileRequest; - })(); - - v1p2beta1.AsyncAnnotateFileResponse = (function() { - - /** - * Properties of an AsyncAnnotateFileResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IAsyncAnnotateFileResponse - * @property {google.cloud.vision.v1p2beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig - */ - - /** - * Constructs a new AsyncAnnotateFileResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AsyncAnnotateFileResponse. - * @implements IAsyncAnnotateFileResponse - * @constructor - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - */ - function AsyncAnnotateFileResponse(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]]; - } - - /** - * AsyncAnnotateFileResponse outputConfig. - * @member {google.cloud.vision.v1p2beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @instance - */ - AsyncAnnotateFileResponse.prototype.outputConfig = null; - - /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance - */ - AsyncAnnotateFileResponse.create = function create(properties) { - return new AsyncAnnotateFileResponse(properties); - }; - - /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @static - * @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 - */ - AsyncAnnotateFileResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1p2beta1.OutputConfig.encode(message.outputConfig, 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.v1p2beta1.AsyncAnnotateFileResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @static - * @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 - */ - AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. - * @function decode - * @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.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncAnnotateFileResponse message. - * @function verify - * @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 - */ - AsyncAnnotateFileResponse.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; - } - return null; - }; - - /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse - */ - AsyncAnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncAnnotateFileResponse.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); - return object; - }; - - /** - * Converts this AsyncAnnotateFileResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncAnnotateFileResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncAnnotateFileResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse"; - }; - - return AsyncAnnotateFileResponse; - })(); - - v1p2beta1.AsyncBatchAnnotateFilesRequest = (function() { - - /** - * Properties of an AsyncBatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IAsyncBatchAnnotateFilesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests - */ - - /** - * Constructs a new AsyncBatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesRequest. - * @implements IAsyncBatchAnnotateFilesRequest - * @constructor - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - */ - function AsyncBatchAnnotateFilesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * AsyncBatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @instance - */ - AsyncBatchAnnotateFilesRequest.prototype.requests = $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 - */ - AsyncBatchAnnotateFilesRequest.create = function create(properties) { - return new AsyncBatchAnnotateFilesRequest(properties); - }; - - /** - * 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 - */ - 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; - }; - - /** - * 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 - */ - AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * 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 - */ - 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()); - }; - - /** - * 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 - */ - 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; - }; - - /** - * 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 - */ - 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; - }; - - /** - * 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 - */ - 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; - }; - - /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateFilesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest"; - }; - - return AsyncBatchAnnotateFilesRequest; - })(); - - v1p2beta1.AsyncBatchAnnotateFilesResponse = (function() { - - /** - * Properties of an AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IAsyncBatchAnnotateFilesResponse - * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses - */ - - /** - * 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 - */ - 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.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @instance - */ - AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance - */ - AsyncBatchAnnotateFilesResponse.create = function create(properties) { - return new AsyncBatchAnnotateFilesResponse(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @static - * @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 - */ - 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.v1p2beta1.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.v1p2beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @static - * @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 - */ - 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.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.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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse - */ - AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p2beta1.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.v1p2beta1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); - } - 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); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateFilesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse"; - }; - - return AsyncBatchAnnotateFilesResponse; - })(); - - v1p2beta1.InputConfig = (function() { - - /** - * Properties of an InputConfig. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IInputConfig - * @property {google.cloud.vision.v1p2beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource - * @property {string|null} [mimeType] InputConfig mimeType - */ - - /** - * Constructs a new InputConfig. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig - * @constructor - * @param {google.cloud.vision.v1p2beta1.IInputConfig=} [properties] Properties to set - */ - function InputConfig(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]]; - } - - /** - * InputConfig gcsSource. - * @member {google.cloud.vision.v1p2beta1.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1p2beta1.InputConfig - * @instance - */ - InputConfig.prototype.gcsSource = null; - - /** - * InputConfig mimeType. - * @member {string} mimeType - * @memberof google.cloud.vision.v1p2beta1.InputConfig - * @instance - */ - InputConfig.prototype.mimeType = ""; - - /** - * Creates a new InputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.InputConfig - * @static - * @param {google.cloud.vision.v1p2beta1.IInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig instance - */ - InputConfig.create = function create(properties) { - return new InputConfig(properties); - }; - - /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p2beta1.InputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.InputConfig - * @static - * @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 - */ - InputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.vision.v1p2beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); - return writer; - }; - - /** - * 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.InputConfig - * @static - * @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 - */ - 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.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.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.v1p2beta1.InputConfig(); - 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()); - 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.v1p2beta1.InputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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.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 an InputConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.InputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig - */ - InputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.InputConfig) - 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); - } - 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.v1p2beta1.InputConfig - * @static - * @param {google.cloud.vision.v1p2beta1.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 (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. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.InputConfig - * @instance - * @returns {Object.} JSON object - */ - InputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.InputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.InputConfig"; - }; - - return InputConfig; - })(); - - v1p2beta1.OutputConfig = (function() { - - /** - * Properties of an OutputConfig. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IOutputConfig - * @property {google.cloud.vision.v1p2beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination - * @property {number|null} [batchSize] OutputConfig batchSize - */ - - /** - * Constructs a new OutputConfig. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an OutputConfig. - * @implements IOutputConfig - * @constructor - * @param {google.cloud.vision.v1p2beta1.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]]; - } - - /** - * 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 - * @instance - */ - OutputConfig.prototype.batchSize = 0; - - /** - * Creates a new OutputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.OutputConfig - * @static - * @param {google.cloud.vision.v1p2beta1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig instance - */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); - }; - - /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p2beta1.OutputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.OutputConfig - * @static - * @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 - */ - OutputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) - $root.google.cloud.vision.v1p2beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.batchSize != null && Object.hasOwnProperty.call(message, "batchSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); - return writer; - }; - - /** - * 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.OutputConfig - * @static - * @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 - */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OutputConfig message from the specified reader or buffer. - * @function decode - * @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.OutputConfig} OutputConfig - * @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) { - 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(); - 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(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.OutputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OutputConfig message. - * @function verify - * @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 - */ - OutputConfig.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.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. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.OutputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig - */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.OutputConfig) - 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); - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.OutputConfig - * @static - * @param {google.cloud.vision.v1p2beta1.OutputConfig} message OutputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OutputConfig.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.v1p2beta1.GcsDestination.toObject(message.gcsDestination, options); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - object.batchSize = message.batchSize; - return object; - }; - - /** - * Converts this OutputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.OutputConfig - * @instance - * @returns {Object.} JSON object - */ - OutputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OutputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.OutputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.OutputConfig"; - }; - - return OutputConfig; - })(); - - v1p2beta1.GcsSource = (function() { - - /** - * Properties of a GcsSource. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri - */ - - /** - * Constructs a new GcsSource. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource - * @constructor - * @param {google.cloud.vision.v1p2beta1.IGcsSource=} [properties] Properties to set - */ - function GcsSource(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]]; - } - - /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p2beta1.GcsSource - * @instance - */ - GcsSource.prototype.uri = ""; - - /** - * Creates a new GcsSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.GcsSource - * @static - * @param {google.cloud.vision.v1p2beta1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource instance - */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); - }; - - /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.GcsSource - * @static - * @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 - */ - GcsSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - return writer; - }; - - /** - * 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.GcsSource - * @static - * @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 - */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer. - * @function decode - * @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.GcsSource} GcsSource - * @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) { - 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(); - 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; - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.GcsSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GcsSource message. - * @function verify - * @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 - */ - GcsSource.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 GcsSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.GcsSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource - */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.GcsSource) - return object; - 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 GcsSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.GcsSource - * @static - * @param {google.cloud.vision.v1p2beta1.GcsSource} message GcsSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GcsSource.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; - }; - - /** - * Converts this GcsSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.GcsSource - * @instance - * @returns {Object.} JSON object - */ - GcsSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GcsSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.GcsSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.GcsSource"; - }; - - return GcsSource; - })(); - - v1p2beta1.GcsDestination = (function() { - - /** - * Properties of a GcsDestination. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri - */ - - /** - * 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]]; - } - - /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p2beta1.GcsDestination - * @instance - */ - GcsDestination.prototype.uri = ""; - - /** - * 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 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 && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - return writer; - }; - - /** - * 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 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; - }; - - /** - * 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()); - }; - - /** - * 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 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; - }; - - /** - * 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; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for GcsDestination - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.GcsDestination - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GcsDestination.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.GcsDestination"; - }; - - return GcsDestination; - })(); - - v1p2beta1.OperationMetadata = (function() { - - /** - * 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 - */ - - /** - * 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]]; - } - - /** - * 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 - * @instance - */ - OperationMetadata.prototype.updateTime = null; - - /** - * 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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * 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 an OperationMetadata message from the specified reader or buffer. - * @function decode - * @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.OperationMetadata} OperationMetadata - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationMetadata message. - * @function verify - * @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 - */ - OperationMetadata.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 (error) - return "updateTime." + error; - } - return null; - }; - - /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata - */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.OperationMetadata) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.OperationMetadata(); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - 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); - } - return message; - }; - - /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata - * @static - * @param {google.cloud.vision.v1p2beta1.OperationMetadata} message OperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationMetadata.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] === undefined ? message.state : $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 OperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata - * @instance - * @returns {Object.} JSON object - */ - OperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationMetadata - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.OperationMetadata"; - }; - - /** - * State enum. - * @name google.cloud.vision.v1p2beta1.OperationMetadata.State - * @enum {number} - * @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 {number} - * @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 TextAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @interface ITextAnnotation - * @property {Array.|null} [pages] TextAnnotation pages - * @property {string|null} [text] TextAnnotation text - */ - - /** - * Constructs a new TextAnnotation. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a TextAnnotation. - * @implements ITextAnnotation - * @constructor - * @param {google.cloud.vision.v1p2beta1.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.v1p2beta1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.pages = $util.emptyArray; - - /** - * TextAnnotation text. - * @member {string} text - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.text = ""; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.ITextAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation instance - */ - TextAnnotation.create = function create(properties) { - return new TextAnnotation(properties); - }; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @static - * @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 - */ - 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.v1p2beta1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "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.v1p2beta1.TextAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @static - * @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 - */ - 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.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.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.v1p2beta1.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.v1p2beta1.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.v1p2beta1.TextAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p2beta1.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.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"; - return null; - }; - - /** - * Creates a TextAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation - */ - TextAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation) - 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); - return message; - }; - - /** - * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.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.v1p2beta1.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.v1p2beta1.TextAnnotation - * @instance - * @returns {Object.} JSON object - */ - TextAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.TextAnnotation"; - }; - - 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 - */ - - /** - * 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]]; - } - - /** - * DetectedLanguage languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.languageCode = ""; - - /** - * DetectedLanguage confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.confidence = 0; - - /** - * 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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - return writer; - }; - - /** - * 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(); - }; - - /** - * 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; - }; - - /** - * 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()); - }; - - /** - * 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; - }; - - /** - * 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; - }; - - /** - * 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; - return object; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for DetectedLanguage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage"; - }; - - return DetectedLanguage; - })(); - - TextAnnotation.DetectedBreak = (function() { - - /** - * 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 - */ - - /** - * 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]]; - } - - /** - * DetectedBreak type. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType} type - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.type = 0; - - /** - * DetectedBreak isPrefix. - * @member {boolean} isPrefix - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.isPrefix = false; - - /** - * 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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.isPrefix != null && Object.hasOwnProperty.call(message, "isPrefix")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isPrefix); - return writer; - }; - - /** - * 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(); - }; - - /** - * 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; - }; - - /** - * 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) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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] === undefined ? message.type : $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); - }; - - /** - * Gets the default type url for DetectedBreak - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak"; - }; - - /** - * BreakType enum. - * @name google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType - * @enum {number} - * @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 && Object.hasOwnProperty.call(message, "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); - }; - - /** - * Gets the default type url for TextProperty - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextProperty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty"; - }; - - 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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.width); - if (message.height != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "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(); - }; - - /** - * Decodes a Page message from the specified reader or buffer. - * @function decode - * @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.Page} Page - * @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) { - 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(); - 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())); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Page - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Page.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Page message. - * @function verify - * @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 - */ - Page.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.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.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. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Page - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Page} Page - */ - Page.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Page) - 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); - } - 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.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. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Page - * @static - * @param {google.cloud.vision.v1p2beta1.Page} message Page - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.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); - } - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - return object; - }; - - /** - * Converts this Page to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Page - * @instance - * @returns {Object.} JSON object - */ - Page.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Page - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Page - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Page"; - }; - - return Page; - })(); - - v1p2beta1.Block = (function() { - - /** - * Properties of a Block. - * @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 - */ - - /** - * Constructs a new Block. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Block. - * @implements IBlock - * @constructor - * @param {google.cloud.vision.v1p2beta1.IBlock=} [properties] Properties to set - */ - function Block(properties) { - this.paragraphs = []; - 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]]; - } - - /** - * 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 - * @instance - */ - Block.prototype.blockType = 0; - - /** - * Block confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.Block - * @instance - */ - Block.prototype.confidence = 0; - - /** - * Creates a new Block instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.Block - * @static - * @param {google.cloud.vision.v1p2beta1.IBlock=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Block} Block instance - */ - Block.create = function create(properties) { - return new Block(properties); - }; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Block.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.Block - * @static - * @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 - */ - Block.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.property != null && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "blockType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.blockType); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - return writer; - }; - - /** - * 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.Block - * @static - * @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 - */ - Block.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Block message from the specified reader or buffer. - * @function decode - * @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.Block} Block - * @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) { - 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(); - 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.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(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Block - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Block.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Block message. - * @function verify - * @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 - */ - Block.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 (error) - return "paragraphs." + 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 Block message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Block - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Block} Block - */ - Block.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Block) - 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]); - } - } - switch (object.blockType) { - default: - if (typeof object.blockType === "number") { - message.blockType = object.blockType; - break; - } - break; - 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 Block message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Block - * @static - * @param {google.cloud.vision.v1p2beta1.Block} message Block - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Block.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); - } - if (message.blockType != null && message.hasOwnProperty("blockType")) - object.blockType = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Block.BlockType[message.blockType] === undefined ? message.blockType : $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 Block to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Block - * @instance - * @returns {Object.} JSON object - */ - Block.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Block - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Block - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Block"; - }; - - /** - * BlockType enum. - * @name google.cloud.vision.v1p2beta1.Block.BlockType - * @enum {number} - * @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; - })(); - - return Block; - })(); - - v1p2beta1.Paragraph = (function() { - - /** - * 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 - */ - - /** - * 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]]; - } - - /** - * Paragraph property. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @instance - */ - Paragraph.prototype.property = null; - - /** - * Paragraph boundingBox. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @instance - */ - Paragraph.prototype.boundingBox = null; - - /** - * 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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "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); - }; - - /** - * Gets the default type url for Paragraph - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Paragraph"; - }; - - 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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "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); - }; - - /** - * Gets the default type url for Word - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Word.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Word"; - }; - - 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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "text")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.text); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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); - }; - - /** - * Gets the default type url for Symbol - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.Symbol - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Symbol.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.Symbol"; - }; - - 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); - }; - - /** - * Gets the default type url for WebDetection - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.WebDetection"; - }; - - 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 && Object.hasOwnProperty.call(message, "entityId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.entityId); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - return writer; - }; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebEntity.verify|verify} messages. - * @function encodeDelimited - * @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.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @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.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decode = function decode(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.WebEntity(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.entityId = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.description = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebEntity message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebEntity.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.entityId != null && message.hasOwnProperty("entityId")) - if (!$util.isString(message.entityId)) - return "entityId: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - return null; - }; - - /** - * Creates a WebEntity message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebEntity} WebEntity - */ - WebEntity.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity(); - if (object.entityId != null) - message.entityId = String(object.entityId); - if (object.score != null) - message.score = Number(object.score); - if (object.description != null) - message.description = String(object.description); - return message; - }; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.WebEntity} message WebEntity - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebEntity.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.entityId = ""; - object.score = 0; - object.description = ""; - } - if (message.entityId != null && message.hasOwnProperty("entityId")) - object.entityId = message.entityId; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - return object; - }; - - /** - * Converts this WebEntity to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @instance - * @returns {Object.} JSON object - */ - WebEntity.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebEntity - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebEntity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.WebDetection.WebEntity"; - }; - - return WebEntity; - })(); - - WebDetection.WebImage = (function() { - - /** - * Properties of a WebImage. - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @interface IWebImage - * @property {string|null} [url] WebImage url - * @property {number|null} [score] WebImage score - */ - - /** - * Constructs a new WebImage. - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @classdesc Represents a WebImage. - * @implements IWebImage - * @constructor - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebImage=} [properties] Properties to set - */ - function WebImage(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]]; - } - - /** - * WebImage url. - * @member {string} url - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.url = ""; - - /** - * WebImage score. - * @member {number} score - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.score = 0; - - /** - * Creates a new WebImage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebImage} WebImage instance - */ - WebImage.create = function create(properties) { - return new WebImage(properties); - }; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - return writer; - }; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @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.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decode = function decode(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.WebImage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebImage message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebImage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - return null; - }; - - /** - * Creates a WebImage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebImage} WebImage - */ - WebImage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - return message; - }; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.WebImage} message WebImage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebImage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.url = ""; - object.score = 0; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - return object; - }; - - /** - * Converts this WebImage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @instance - * @returns {Object.} JSON object - */ - WebImage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebImage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebImage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebImage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.WebDetection.WebImage"; - }; - - return WebImage; - })(); - - WebDetection.WebPage = (function() { - - /** - * Properties of a WebPage. - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @interface IWebPage - * @property {string|null} [url] WebPage url - * @property {number|null} [score] WebPage score - * @property {string|null} [pageTitle] WebPage pageTitle - * @property {Array.|null} [fullMatchingImages] WebPage fullMatchingImages - * @property {Array.|null} [partialMatchingImages] WebPage partialMatchingImages - */ - - /** - * Constructs a new WebPage. - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @classdesc Represents a WebPage. - * @implements IWebPage - * @constructor - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebPage=} [properties] Properties to set - */ - function WebPage(properties) { - this.fullMatchingImages = []; - this.partialMatchingImages = []; - 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]]; - } - - /** - * WebPage url. - * @member {string} url - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.url = ""; - - /** - * WebPage score. - * @member {number} score - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.score = 0; - - /** - * WebPage pageTitle. - * @member {string} pageTitle - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.pageTitle = ""; - - /** - * WebPage fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebPage partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.partialMatchingImages = $util.emptyArray; - - /** - * Creates a new WebPage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebPage} WebPage instance - */ - WebPage.create = function create(properties) { - return new WebPage(properties); - }; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebPage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pageTitle != null && Object.hasOwnProperty.call(message, "pageTitle")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageTitle); - 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 4, wireType 2 =*/34).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 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebPage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @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.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decode = function decode(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.WebPage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.pageTitle = reader.string(); - break; - } - case 4: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebPage message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebPage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - if (!$util.isString(message.pageTitle)) - return "pageTitle: string expected"; - 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; - } - } - return null; - }; - - /** - * Creates a WebPage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebPage} WebPage - */ - WebPage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - if (object.pageTitle != null) - message.pageTitle = String(object.pageTitle); - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.WebPage.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.WebPage.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.WebPage.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.WebPage.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.WebPage} message WebPage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebPage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.fullMatchingImages = []; - object.partialMatchingImages = []; - } - if (options.defaults) { - object.url = ""; - object.score = 0; - object.pageTitle = ""; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - object.pageTitle = message.pageTitle; - 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); - } - return object; - }; - - /** - * Converts this WebPage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @instance - * @returns {Object.} JSON object - */ - WebPage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebPage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebPage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebPage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.WebDetection.WebPage"; - }; - - return WebPage; - })(); - - WebDetection.WebLabel = (function() { - - /** - * Properties of a WebLabel. - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @interface IWebLabel - * @property {string|null} [label] WebLabel label - * @property {string|null} [languageCode] WebLabel languageCode - */ - - /** - * Constructs a new WebLabel. - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @classdesc Represents a WebLabel. - * @implements IWebLabel - * @constructor - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebLabel=} [properties] Properties to set - */ - function WebLabel(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]]; - } - - /** - * WebLabel label. - * @member {string} label - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.label = ""; - - /** - * WebLabel languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.languageCode = ""; - - /** - * Creates a new WebLabel instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebLabel=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebLabel} WebLabel instance - */ - WebLabel.create = function create(properties) { - return new WebLabel(properties); - }; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebLabel.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.label); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - return writer; - }; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebLabel.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @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.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decode = function decode(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.WebLabel(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.label = reader.string(); - break; - } - case 2: { - message.languageCode = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebLabel message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebLabel.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.label != null && message.hasOwnProperty("label")) - if (!$util.isString(message.label)) - return "label: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - return null; - }; - - /** - * Creates a WebLabel message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebLabel} WebLabel - */ - WebLabel.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel(); - if (object.label != null) - message.label = String(object.label); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - return message; - }; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.WebLabel} message WebLabel - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebLabel.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - 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; - }; - - /** - * Converts this WebLabel to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @instance - * @returns {Object.} JSON object - */ - WebLabel.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebLabel - * @function getTypeUrl - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebLabel - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebLabel.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p2beta1.WebDetection.WebLabel"; - }; - - return WebLabel; - })(); - - return WebDetection; - })(); - - return v1p2beta1; - })(); - - vision.v1p3beta1 = (function() { - - /** - * Namespace v1p3beta1. - * @memberof google.cloud.vision - * @namespace - */ - var v1p3beta1 = {}; - - v1p3beta1.Vertex = (function() { - - /** - * Properties of a Vertex. - * @memberof google.cloud.vision.v1p3beta1 - * @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 {google.cloud.vision.v1p3beta1.IVertex=} [properties] Properties to set - */ - 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]]; - } - - /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p3beta1.Vertex - * @instance - */ - Vertex.prototype.x = 0; - - /** - * 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.Vertex - * @static - * @param {google.cloud.vision.v1p3beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex instance - */ - Vertex.create = function create(properties) { - return new Vertex(properties); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); - return writer; - }; - - /** - * 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 - */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * 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; - }; - - /** - * 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()); - }; - - /** - * 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 - */ - 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; - }; - - /** - * 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 - * @returns {Object.} JSON object - */ - Vertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Vertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Vertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Vertex"; - }; - - return Vertex; - })(); - - v1p3beta1.NormalizedVertex = (function() { - - /** - * Properties of a NormalizedVertex. - * @memberof google.cloud.vision.v1p3beta1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y - */ - - /** - * Constructs a new NormalizedVertex. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex - * @constructor - * @param {google.cloud.vision.v1p3beta1.INormalizedVertex=} [properties] Properties to set - */ - function NormalizedVertex(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]]; - } - - /** - * NormalizedVertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @instance - */ - NormalizedVertex.prototype.x = 0; - - /** - * NormalizedVertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @instance - */ - NormalizedVertex.prototype.y = 0; - - /** - * Creates a new NormalizedVertex instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @static - * @param {google.cloud.vision.v1p3beta1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex instance - */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); - }; - - /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @static - * @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 - */ - NormalizedVertex.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - return writer; - }; - - /** - * 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.NormalizedVertex - * @static - * @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 - */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer. - * @function decode - * @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.NormalizedVertex} NormalizedVertex - * @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) { - 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(); - 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; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NormalizedVertex message. - * @function verify - * @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 - */ - NormalizedVertex.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"; - return null; - }; - - /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex - */ - NormalizedVertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.NormalizedVertex) - 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); - return message; - }; - - /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @static - * @param {google.cloud.vision.v1p3beta1.NormalizedVertex} message NormalizedVertex - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NormalizedVertex.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; - return object; - }; - - /** - * Converts this NormalizedVertex to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @instance - * @returns {Object.} JSON object - */ - NormalizedVertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NormalizedVertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NormalizedVertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.NormalizedVertex"; - }; - - return NormalizedVertex; - })(); - - v1p3beta1.BoundingPoly = (function() { - - /** - * Properties of a BoundingPoly. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices - */ - - /** - * Constructs a new BoundingPoly. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly - * @constructor - * @param {google.cloud.vision.v1p3beta1.IBoundingPoly=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * 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 - * @instance - */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly - * @static - * @param {google.cloud.vision.v1p3beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly instance - */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); - }; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly - * @static - * @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 - */ - BoundingPoly.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(); - return writer; - }; - - /** - * 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.BoundingPoly - * @static - * @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 - */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @function decode - * @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.BoundingPoly} BoundingPoly - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BoundingPoly message. - * @function verify - * @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 - */ - BoundingPoly.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; - } - } - return null; - }; - - /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly - */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.BoundingPoly) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly - * @static - * @param {google.cloud.vision.v1p3beta1.BoundingPoly} message BoundingPoly - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoundingPoly.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); - } - return object; - }; - - /** - * Converts this BoundingPoly to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly - * @instance - * @returns {Object.} JSON object - */ - BoundingPoly.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BoundingPoly - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.BoundingPoly"; - }; - - return BoundingPoly; - })(); - - v1p3beta1.Position = (function() { - - /** - * Properties of a Position. - * @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 - */ - - /** - * Constructs a new Position. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Position. - * @implements IPosition - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1p3beta1.Position - * @instance - */ - Position.prototype.x = 0; - - /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1p3beta1.Position - * @instance - */ - Position.prototype.y = 0; - - /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1p3beta1.Position - * @instance - */ - Position.prototype.z = 0; - - /** - * Creates a new Position instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Position - * @static - * @param {google.cloud.vision.v1p3beta1.IPosition=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Position} Position instance - */ - Position.create = function create(properties) { - return new Position(properties); - }; - - /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. - * @function encode - * @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.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && Object.hasOwnProperty.call(message, "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: { - 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; - }; - - /** - * 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 Position message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Position - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Position} Position - */ - Position.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Position) - 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); - return message; - }; - - /** - * Creates a plain object from a Position message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Position - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.Position - * @instance - * @returns {Object.} JSON object - */ - Position.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Position - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Position - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Position.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Position"; - }; - - 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 - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ImageAnnotator; - })(); - - v1p3beta1.Feature = (function() { - - /** - * 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 - */ - - /** - * 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]]; - } - - /** - * 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 - * @instance - */ - Feature.prototype.maxResults = 0; - - /** - * Feature model. - * @member {string} model - * @memberof google.cloud.vision.v1p3beta1.Feature - * @instance - */ - Feature.prototype.model = ""; - - /** - * 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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && Object.hasOwnProperty.call(message, "model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); - return writer; - }; - - /** - * 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(); - }; - - /** - * 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 = reader.int32(); - break; - } - case 2: { - message.maxResults = reader.int32(); - break; - } - case 3: { - message.model = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * 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.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) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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 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] === undefined ? message.type : $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; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for Feature - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Feature - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Feature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Feature"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p3beta1.Feature.Type - * @enum {number} - * @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; - })(); - - v1p3beta1.ImageSource = (function() { - - /** - * Properties of an ImageSource. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri - */ - - /** - * Constructs a new ImageSource. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageSource. - * @implements IImageSource - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1p3beta1.ImageSource - * @instance - */ - ImageSource.prototype.gcsImageUri = ""; - - /** - * 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.ImageSource - * @static - * @param {google.cloud.vision.v1p3beta1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource instance - */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); - }; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImageSource - * @static - * @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 - */ - ImageSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsImageUri != null && Object.hasOwnProperty.call(message, "gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); - return writer; - }; - - /** - * 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.ImageSource - * @static - * @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 - */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer. - * @function decode - * @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.ImageSource} ImageSource - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsImageUri = reader.string(); - break; - } - case 2: { - message.imageUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageSource message. - * @function verify - * @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 - */ - ImageSource.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"; - return null; - }; - - /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImageSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource - */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageSource) - 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); - return message; - }; - - /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImageSource - * @static - * @param {google.cloud.vision.v1p3beta1.ImageSource} message ImageSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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 ImageSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImageSource - * @instance - * @returns {Object.} JSON object - */ - ImageSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ImageSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ImageSource"; - }; - - return ImageSource; - })(); - - v1p3beta1.Image = (function() { - - /** - * Properties of an Image. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1p3beta1.IImageSource|null} [source] Image source - */ - - /** - * Constructs a new Image. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an Image. - * @implements IImage - * @constructor - * @param {google.cloud.vision.v1p3beta1.IImage=} [properties] Properties to set - */ - function Image(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]]; - } - - /** - * 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 - * @instance - */ - Image.prototype.source = null; - - /** - * Creates a new Image instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Image - * @static - * @param {google.cloud.vision.v1p3beta1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Image} Image instance - */ - Image.create = function create(properties) { - return new Image(properties); - }; - - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Image.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Image - * @static - * @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 - */ - Image.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && Object.hasOwnProperty.call(message, "source")) - $root.google.cloud.vision.v1p3beta1.ImageSource.encode(message.source, 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.v1p3beta1.Image.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Image - * @static - * @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 - */ - Image.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Image message from the specified reader or buffer. - * @function decode - * @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.Image} Image - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Image - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Image.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Image message. - * @function verify - * @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 - */ - Image.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; - } - return null; - }; - - /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Image - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Image} Image - */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Image) - 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 >= 0) - 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 an Image message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Image - * @static - * @param {google.cloud.vision.v1p3beta1.Image} message Image - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Image.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 (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. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Image - * @instance - * @returns {Object.} JSON object - */ - Image.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Image - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Image - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Image.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Image"; - }; - - return Image; - })(); - - v1p3beta1.FaceAnnotation = (function() { - - /** - * Properties of a FaceAnnotation. - * @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 - */ - - /** - * Constructs a new FaceAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation - * @constructor - * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * 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 - * @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.FaceAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation instance - */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); - }; - - /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.verify|verify} messages. - * @function encode - * @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.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && Object.hasOwnProperty.call(message, "panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && Object.hasOwnProperty.call(message, "tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && Object.hasOwnProperty.call(message, "detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && Object.hasOwnProperty.call(message, "landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && Object.hasOwnProperty.call(message, "joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && Object.hasOwnProperty.call(message, "sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && Object.hasOwnProperty.call(message, "angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && Object.hasOwnProperty.call(message, "surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && Object.hasOwnProperty.call(message, "underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && Object.hasOwnProperty.call(message, "blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && Object.hasOwnProperty.call(message, "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: - 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 a FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation - */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.FaceAnnotation) - 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) { - default: - if (typeof object.joyLikelihood === "number") { - message.joyLikelihood = object.joyLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.sorrowLikelihood === "number") { - message.sorrowLikelihood = object.sorrowLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.angerLikelihood === "number") { - message.angerLikelihood = object.angerLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.surpriseLikelihood === "number") { - message.surpriseLikelihood = object.surpriseLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.underExposedLikelihood === "number") { - message.underExposedLikelihood = object.underExposedLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.blurredLikelihood === "number") { - message.blurredLikelihood = object.blurredLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.headwearLikelihood === "number") { - message.headwearLikelihood = object.headwearLikelihood; - break; - } - break; - 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 FaceAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.FaceAnnotation} message FaceAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FaceAnnotation.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); - } - 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] === undefined ? message.joyLikelihood : $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] === undefined ? message.sorrowLikelihood : $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] === undefined ? message.angerLikelihood : $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] === undefined ? message.surpriseLikelihood : $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] === undefined ? message.underExposedLikelihood : $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] === undefined ? message.blurredLikelihood : $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] === undefined ? message.headwearLikelihood : $root.google.cloud.vision.v1p3beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; - return object; - }; - - /** - * Converts this FaceAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - * @returns {Object.} JSON object - */ - FaceAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FaceAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FaceAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.FaceAnnotation"; - }; - - 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 - */ - - /** - * 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]]; - } - - /** - * Landmark type. - * @member {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 0; - - /** - * Landmark position. - * @member {google.cloud.vision.v1p3beta1.IPosition|null|undefined} position - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.position = null; - - /** - * 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 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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && Object.hasOwnProperty.call(message, "position")) - $root.google.cloud.vision.v1p3beta1.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.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) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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.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] === undefined ? message.type : $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; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for Landmark - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Landmark.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type - * @enum {number} - * @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; - })(); - - v1p3beta1.LocationInfo = (function() { - - /** - * Properties of a LocationInfo. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng - */ - - /** - * Constructs a new LocationInfo. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a LocationInfo. - * @implements ILocationInfo - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.LocationInfo - * @instance - */ - LocationInfo.prototype.latLng = null; - - /** - * Creates a new LocationInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p3beta1.ILocationInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo instance - */ - LocationInfo.create = function create(properties) { - return new LocationInfo(properties); - }; - - /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocationInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.LocationInfo - * @static - * @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 - */ - LocationInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLng != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.LocationInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.LocationInfo - * @static - * @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 - */ - 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.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.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.v1p3beta1.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.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 LocationInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p3beta1.LocationInfo} message LocationInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LocationInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.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.v1p3beta1.LocationInfo - * @instance - * @returns {Object.} JSON object - */ - LocationInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocationInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.LocationInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.LocationInfo"; - }; - - return LocationInfo; - })(); - - v1p3beta1.Property = (function() { - - /** - * Properties of a Property. - * @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 - */ - - /** - * Constructs a new Property. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Property. - * @implements IProperty - * @constructor - * @param {google.cloud.vision.v1p3beta1.IProperty=} [properties] Properties to set - */ - function Property(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * Property value. - * @member {string} value - * @memberof google.cloud.vision.v1p3beta1.Property - * @instance - */ - Property.prototype.value = ""; - - /** - * 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.Property - * @static - * @param {google.cloud.vision.v1p3beta1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Property} Property instance - */ - Property.create = function create(properties) { - return new Property(properties); - }; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Property.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Property - * @static - * @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 - */ - Property.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && Object.hasOwnProperty.call(message, "uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); - return writer; - }; - - /** - * 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.Property - * @static - * @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 - */ - Property.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Property message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.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.Property} Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Property.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.Property(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - case 3: { - message.uint64Value = reader.uint64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Property - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Property.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Property message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.Property - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Property.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.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 Property message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Property - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Property} Property - */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Property) - 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); - return message; - }; - - /** - * Creates a plain object from a Property message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Property - * @static - * @param {google.cloud.vision.v1p3beta1.Property} message Property - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Property.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.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 Property to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Property - * @instance - * @returns {Object.} JSON object - */ - Property.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Property - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Property - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Property"; - }; - - return Property; - })(); - - v1p3beta1.EntityAnnotation = (function() { - - /** - * Properties of an EntityAnnotation. - * @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 - */ - - /** - * Constructs a new EntityAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation - * @constructor - * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.mid = ""; - - /** - * 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.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.score = 0; - - /** - * EntityAnnotation confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.confidence = 0; - - /** - * 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.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation instance - */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); - }; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.EntityAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @static - * @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 - */ - EntityAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && Object.hasOwnProperty.call(message, "locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && Object.hasOwnProperty.call(message, "topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "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 EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.EntityAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @static - * @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 - */ - EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer. - * @function decode - * @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.EntityAnnotation} EntityAnnotation - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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.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); - 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.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 an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation - */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.EntityAnnotation) - 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); - 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 an EntityAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.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.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 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); - }; - - /** - * Gets the default type url for EntityAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EntityAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.EntityAnnotation"; - }; - - 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]]; - } - - /** - * LocalizedObjectAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.mid = ""; - - /** - * 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.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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * 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(); - }; - - /** - * 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) { - case 1: { - 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); - 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) - 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 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); - }; - - /** - * Gets the default type url for LocalizedObjectAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocalizedObjectAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation"; - }; - - return LocalizedObjectAnnotation; - })(); - - v1p3beta1.SafeSearchAnnotation = (function() { - - /** - * Properties of a SafeSearchAnnotation. - * @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 - */ - - /** - * Constructs a new SafeSearchAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.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 - * @instance - */ - SafeSearchAnnotation.prototype.racy = 0; - - /** - * Creates a new SafeSearchAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation instance - */ - SafeSearchAnnotation.create = function create(properties) { - return new SafeSearchAnnotation(properties); - }; - - /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.SafeSearchAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @static - * @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 - */ - SafeSearchAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.adult != null && Object.hasOwnProperty.call(message, "adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && Object.hasOwnProperty.call(message, "spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && Object.hasOwnProperty.call(message, "medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && Object.hasOwnProperty.call(message, "violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.SafeSearchAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @static - * @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 - */ - 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.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.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.v1p3beta1.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; - }; - - /** - * 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) { - default: - if (typeof object.adult === "number") { - message.adult = object.adult; - break; - } - break; - 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) { - default: - if (typeof object.spoof === "number") { - message.spoof = object.spoof; - break; - } - break; - 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) { - default: - if (typeof object.medical === "number") { - message.medical = object.medical; - break; - } - break; - 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) { - default: - if (typeof object.violence === "number") { - message.violence = object.violence; - break; - } - break; - 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) { - default: - if (typeof object.racy === "number") { - message.racy = object.racy; - break; - } - break; - 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 SafeSearchAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} message SafeSearchAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SafeSearchAnnotation.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] === undefined ? message.adult : $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] === undefined ? message.spoof : $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] === undefined ? message.medical : $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] === undefined ? message.violence : $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] === undefined ? message.racy : $root.google.cloud.vision.v1p3beta1.Likelihood[message.racy] : message.racy; - return object; - }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @instance - * @returns {Object.} JSON object - */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SafeSearchAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.SafeSearchAnnotation"; - }; - - return SafeSearchAnnotation; - })(); - - v1p3beta1.LatLongRect = (function() { - - /** - * Properties of a LatLongRect. - * @memberof google.cloud.vision.v1p3beta1 - * @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.v1p3beta1 - * @classdesc Represents a LatLongRect. - * @implements ILatLongRect - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.minLatLng = null; - - /** - * LatLongRect maxLatLng. - * @member {google.type.ILatLng|null|undefined} maxLatLng - * @memberof google.cloud.vision.v1p3beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.maxLatLng = null; - - /** - * Creates a new LatLongRect instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p3beta1.ILatLongRect=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect instance - */ - LatLongRect.create = function create(properties) { - return new LatLongRect(properties); - }; - - /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p3beta1.LatLongRect.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.LatLongRect - * @static - * @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 - */ - LatLongRect.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minLatLng != null && Object.hasOwnProperty.call(message, "minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.LatLongRect.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.LatLongRect - * @static - * @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 - */ - 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.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.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.v1p3beta1.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.v1p3beta1.LatLongRect - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p3beta1.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.v1p3beta1.LatLongRect - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect - */ - LatLongRect.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.LatLongRect) - 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); - } - return message; - }; - - /** - * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p3beta1.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 LatLongRect to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.LatLongRect - * @instance - * @returns {Object.} JSON object - */ - LatLongRect.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LatLongRect - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.LatLongRect - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LatLongRect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.LatLongRect"; - }; - - return LatLongRect; - })(); - - v1p3beta1.ColorInfo = (function() { - - /** - * Properties of a ColorInfo. - * @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 - */ - - /** - * Constructs a new ColorInfo. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * 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 - */ - ColorInfo.prototype.pixelFraction = 0; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p3beta1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo instance - */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); - }; - - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ColorInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ColorInfo - * @static - * @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 - */ - ColorInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.color != null && Object.hasOwnProperty.call(message, "color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && Object.hasOwnProperty.call(message, "pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); - return writer; - }; - - /** - * 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.ColorInfo - * @static - * @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 - */ - ColorInfo.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.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.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.v1p3beta1.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; - } - } - return message; - }; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ColorInfo.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.v1p3beta1.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; - }; - - /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ColorInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo - */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ColorInfo) - 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); - } - 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.v1p3beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p3beta1.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 ColorInfo to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ColorInfo - * @instance - * @returns {Object.} JSON object - */ - ColorInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ColorInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ColorInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ColorInfo"; - }; - - return ColorInfo; - })(); - - v1p3beta1.DominantColorsAnnotation = (function() { - - /** - * Properties of a DominantColorsAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors - */ - - /** - * Constructs a new DominantColorsAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation - * @constructor - * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation=} [properties] Properties to set - */ - function DominantColorsAnnotation(properties) { - this.colors = []; - 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]]; - } - - /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @instance - */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation instance - */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); - }; - - /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DominantColorsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @static - * @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 - */ - 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.v1p3beta1.ColorInfo.encode(message.colors[i], 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.v1p3beta1.DominantColorsAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @static - * @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 - */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. - * @function decode - * @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.DominantColorsAnnotation} DominantColorsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DominantColorsAnnotation message. - * @function verify - * @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 - */ - DominantColorsAnnotation.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; - } - } - return null; - }; - - /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation - */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} message DominantColorsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DominantColorsAnnotation.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); - } - return object; - }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @instance - * @returns {Object.} JSON object - */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DominantColorsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.DominantColorsAnnotation"; - }; - - return DominantColorsAnnotation; - })(); - - v1p3beta1.ImageProperties = (function() { - - /** - * Properties of an ImageProperties. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IImageProperties - * @property {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors - */ - - /** - * Constructs a new ImageProperties. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties - * @constructor - * @param {google.cloud.vision.v1p3beta1.IImageProperties=} [properties] Properties to set - */ - 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]]; - } - - /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1p3beta1.ImageProperties - * @instance - */ - ImageProperties.prototype.dominantColors = null; - - /** - * Creates a new ImageProperties instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ImageProperties - * @static - * @param {google.cloud.vision.v1p3beta1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties instance - */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); - }; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageProperties.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImageProperties - * @static - * @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 - */ - ImageProperties.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dominantColors != null && Object.hasOwnProperty.call(message, "dominantColors")) - $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageProperties - * @static - * @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 - */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer. - * @function decode - * @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.ImageProperties} ImageProperties - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageProperties - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageProperties message. - * @function verify - * @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 - */ - ImageProperties.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; - } - return null; - }; - - /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImageProperties - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties - */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageProperties) - 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); - } - return message; - }; - - /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImageProperties - * @static - * @param {google.cloud.vision.v1p3beta1.ImageProperties} message ImageProperties - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageProperties.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); - return object; - }; - - /** - * Converts this ImageProperties to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImageProperties - * @instance - * @returns {Object.} JSON object - */ - ImageProperties.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageProperties - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ImageProperties - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ImageProperties"; - }; - - return ImageProperties; - })(); - - v1p3beta1.CropHint = (function() { - - /** - * Properties of a CropHint. - * @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 - */ - - /** - * Constructs a new CropHint. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CropHint. - * @implements ICropHint - * @constructor - * @param {google.cloud.vision.v1p3beta1.ICropHint=} [properties] Properties to set - */ - function CropHint(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]]; - } - - /** - * 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 - * @instance - */ - CropHint.prototype.confidence = 0; - - /** - * CropHint importanceFraction. - * @member {number} importanceFraction - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @instance - */ - CropHint.prototype.importanceFraction = 0; - - /** - * Creates a new CropHint instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @static - * @param {google.cloud.vision.v1p3beta1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint instance - */ - CropHint.create = function create(properties) { - return new CropHint(properties); - }; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHint.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @static - * @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 - */ - CropHint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && Object.hasOwnProperty.call(message, "importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); - return writer; - }; - - /** - * 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.CropHint - * @static - * @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 - */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHint message from the specified reader or buffer. - * @function decode - * @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.CropHint} CropHint - * @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) { - 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(); - 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.confidence = reader.float(); - break; - } - case 3: { - message.importanceFraction = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHint message. - * @function verify - * @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 - */ - CropHint.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.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. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint - */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHint) - 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); - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @static - * @param {google.cloud.vision.v1p3beta1.CropHint} message CropHint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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.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 CropHint to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @instance - * @returns {Object.} JSON object - */ - CropHint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHint - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.CropHint"; - }; - - return CropHint; - })(); - - v1p3beta1.CropHintsAnnotation = (function() { - - /** - * Properties of a CropHintsAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints - */ - - /** - * Constructs a new CropHintsAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation - * @constructor - * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation - * @instance - */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation instance - */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); - }; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.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(); - return writer; - }; - - /** - * 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.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. - * @function decode - * @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.CropHintsAnnotation} CropHintsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsAnnotation message. - * @function verify - * @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 - */ - CropHintsAnnotation.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; - } - } - return null; - }; - - /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation - */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.CropHintsAnnotation} message CropHintsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsAnnotation.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); - } - return object; - }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation - * @instance - * @returns {Object.} JSON object - */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.CropHintsAnnotation"; - }; - - return CropHintsAnnotation; - })(); - - v1p3beta1.CropHintsParams = (function() { - - /** - * Properties of a CropHintsParams. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios - */ - - /** - * Constructs a new CropHintsParams. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams - * @constructor - * @param {google.cloud.vision.v1p3beta1.ICropHintsParams=} [properties] Properties to set - */ - function CropHintsParams(properties) { - this.aspectRatios = []; - 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]]; - } - - /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams - * @instance - */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams - * @static - * @param {google.cloud.vision.v1p3beta1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams instance - */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); - }; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams - * @static - * @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 - */ - CropHintsParams.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(); - } - return writer; - }; - - /** - * 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.CropHintsParams - * @static - * @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 - */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer. - * @function decode - * @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.CropHintsParams} CropHintsParams - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsParams message. - * @function verify - * @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 - */ - CropHintsParams.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"; - } - return null; - }; - - /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams - */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHintsParams) - 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]); - } - return message; - }; - - /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams - * @static - * @param {google.cloud.vision.v1p3beta1.CropHintsParams} message CropHintsParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsParams.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]; - } - return object; - }; - - /** - * Converts this CropHintsParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams - * @instance - * @returns {Object.} JSON object - */ - CropHintsParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.CropHintsParams"; - }; - - return CropHintsParams; - })(); - - v1p3beta1.WebDetectionParams = (function() { - - /** - * Properties of a WebDetectionParams. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults - */ - - /** - * Constructs a new WebDetectionParams. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams - * @constructor - * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams=} [properties] Properties to set - */ - function WebDetectionParams(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]]; - } - - /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams - * @instance - */ - WebDetectionParams.prototype.includeGeoResults = false; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams instance - */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); - }; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.includeGeoResults != null && Object.hasOwnProperty.call(message, "includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); - return writer; - }; - - /** - * 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.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer. - * @function decode - * @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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams - */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.WebDetectionParams) - return object; - 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 a WebDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetectionParams} message WebDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebDetectionParams.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; - return object; - }; - - /** - * Converts this WebDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams - * @instance - * @returns {Object.} JSON object - */ - WebDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.WebDetectionParams"; - }; - - return WebDetectionParams; - })(); - - v1p3beta1.TextDetectionParams = (function() { - - /** - * Properties of a TextDetectionParams. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ITextDetectionParams - * @property {boolean|null} [enableTextDetectionConfidenceScore] TextDetectionParams enableTextDetectionConfidenceScore - * @property {Array.|null} [advancedOcrOptions] TextDetectionParams advancedOcrOptions - */ - - /** - * Constructs a new TextDetectionParams. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a TextDetectionParams. - * @implements ITextDetectionParams - * @constructor - * @param {google.cloud.vision.v1p3beta1.ITextDetectionParams=} [properties] Properties to set - */ - function TextDetectionParams(properties) { - this.advancedOcrOptions = []; - 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]]; - } - - /** - * TextDetectionParams enableTextDetectionConfidenceScore. - * @member {boolean} enableTextDetectionConfidenceScore - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.enableTextDetectionConfidenceScore = false; - - /** - * TextDetectionParams advancedOcrOptions. - * @member {Array.} advancedOcrOptions - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.advancedOcrOptions = $util.emptyArray; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p3beta1.ITextDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.TextDetectionParams} TextDetectionParams instance - */ - TextDetectionParams.create = function create(properties) { - return new TextDetectionParams(properties); - }; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p3beta1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enableTextDetectionConfidenceScore != null && Object.hasOwnProperty.call(message, "enableTextDetectionConfidenceScore")) - writer.uint32(/* id 9, wireType 0 =*/72).bool(message.enableTextDetectionConfidenceScore); - if (message.advancedOcrOptions != null && message.advancedOcrOptions.length) - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.advancedOcrOptions[i]); - return writer; - }; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextDetectionParams.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p3beta1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @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.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decode = function decode(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.TextDetectionParams(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 9: { - message.enableTextDetectionConfidenceScore = reader.bool(); - break; - } - case 11: { - if (!(message.advancedOcrOptions && message.advancedOcrOptions.length)) - message.advancedOcrOptions = []; - message.advancedOcrOptions.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TextDetectionParams message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TextDetectionParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - if (typeof message.enableTextDetectionConfidenceScore !== "boolean") - return "enableTextDetectionConfidenceScore: boolean expected"; - if (message.advancedOcrOptions != null && message.hasOwnProperty("advancedOcrOptions")) { - if (!Array.isArray(message.advancedOcrOptions)) - return "advancedOcrOptions: array expected"; - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - if (!$util.isString(message.advancedOcrOptions[i])) - return "advancedOcrOptions: string[] expected"; - } - return null; - }; - - /** - * Creates a TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.TextDetectionParams} TextDetectionParams - */ - TextDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.TextDetectionParams) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.TextDetectionParams(); - if (object.enableTextDetectionConfidenceScore != null) - message.enableTextDetectionConfidenceScore = Boolean(object.enableTextDetectionConfidenceScore); - if (object.advancedOcrOptions) { - if (!Array.isArray(object.advancedOcrOptions)) - throw TypeError(".google.cloud.vision.v1p3beta1.TextDetectionParams.advancedOcrOptions: array expected"); - message.advancedOcrOptions = []; - for (var i = 0; i < object.advancedOcrOptions.length; ++i) - message.advancedOcrOptions[i] = String(object.advancedOcrOptions[i]); - } - return message; - }; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p3beta1.TextDetectionParams} message TextDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TextDetectionParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.advancedOcrOptions = []; - if (options.defaults) - object.enableTextDetectionConfidenceScore = false; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - object.enableTextDetectionConfidenceScore = message.enableTextDetectionConfidenceScore; - if (message.advancedOcrOptions && message.advancedOcrOptions.length) { - object.advancedOcrOptions = []; - for (var j = 0; j < message.advancedOcrOptions.length; ++j) - object.advancedOcrOptions[j] = message.advancedOcrOptions[j]; - } - return object; - }; - - /** - * Converts this TextDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @instance - * @returns {Object.} JSON object - */ - TextDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.TextDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.TextDetectionParams"; - }; - - return TextDetectionParams; - })(); - - v1p3beta1.ImageContext = (function() { - - /** - * Properties of an ImageContext. - * @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 - * @property {google.cloud.vision.v1p3beta1.ITextDetectionParams|null} [textDetectionParams] ImageContext textDetectionParams - */ - - /** - * Constructs a new ImageContext. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageContext. - * @implements IImageContext - * @constructor - * @param {google.cloud.vision.v1p3beta1.IImageContext=} [properties] Properties to set - */ - function ImageContext(properties) { - this.languageHints = []; - 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]]; - } - - /** - * 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 - * @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; - - /** - * ImageContext textDetectionParams. - * @member {google.cloud.vision.v1p3beta1.ITextDetectionParams|null|undefined} textDetectionParams - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @instance - */ - ImageContext.prototype.textDetectionParams = null; - - /** - * Creates a new ImageContext instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @static - * @param {google.cloud.vision.v1p3beta1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext instance - */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); - }; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @static - * @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 - */ - ImageContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLongRect != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "cropHintsParams")) - $root.google.cloud.vision.v1p3beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.productSearchParams != null && Object.hasOwnProperty.call(message, "productSearchParams")) - $root.google.cloud.vision.v1p3beta1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.webDetectionParams != null && Object.hasOwnProperty.call(message, "webDetectionParams")) - $root.google.cloud.vision.v1p3beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.textDetectionParams != null && Object.hasOwnProperty.call(message, "textDetectionParams")) - $root.google.cloud.vision.v1p3beta1.TextDetectionParams.encode(message.textDetectionParams, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageContext - * @static - * @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 - */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer. - * @function decode - * @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.ImageContext} ImageContext - * @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) { - 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(); - 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()); - 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()); - break; - } - case 6: { - message.webDetectionParams = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.decode(reader, reader.uint32()); - break; - } - case 12: { - message.textDetectionParams = $root.google.cloud.vision.v1p3beta1.TextDetectionParams.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageContext message. - * @function verify - * @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 - */ - ImageContext.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 (error) - return "webDetectionParams." + error; - } - if (message.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) { - var error = $root.google.cloud.vision.v1p3beta1.TextDetectionParams.verify(message.textDetectionParams); - if (error) - return "textDetectionParams." + error; - } - return null; - }; - - /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext - */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageContext) - 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); - } - if (object.textDetectionParams != null) { - if (typeof object.textDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.textDetectionParams: object expected"); - message.textDetectionParams = $root.google.cloud.vision.v1p3beta1.TextDetectionParams.fromObject(object.textDetectionParams); - } - return message; - }; - - /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @static - * @param {google.cloud.vision.v1p3beta1.ImageContext} message ImageContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageContext.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.textDetectionParams = 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); - if (message.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) - object.textDetectionParams = $root.google.cloud.vision.v1p3beta1.TextDetectionParams.toObject(message.textDetectionParams, options); - return object; - }; - - /** - * Converts this ImageContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @instance - * @returns {Object.} JSON object - */ - ImageContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ImageContext"; - }; - - return ImageContext; - })(); - - v1p3beta1.AnnotateImageRequest = (function() { - - /** - * Properties of an AnnotateImageRequest. - * @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 - */ - - /** - * Constructs a new AnnotateImageRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.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 - * @instance - */ - AnnotateImageRequest.prototype.imageContext = null; - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest instance - */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); - }; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.image != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1p3beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. - * @function decode - * @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.AnnotateImageRequest} AnnotateImageRequest - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateImageRequest message. - * @function verify - * @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 - */ - AnnotateImageRequest.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 (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 an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest - */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest) - 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]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.AnnotateImageRequest} message AnnotateImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateImageRequest.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); - } - 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. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.AnnotateImageRequest"; - }; - - return AnnotateImageRequest; - })(); - - v1p3beta1.ImageAnnotationContext = (function() { - - /** - * Properties of an ImageAnnotationContext. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IImageAnnotationContext - * @property {string|null} [uri] ImageAnnotationContext uri - * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber - */ - - /** - * Constructs a new ImageAnnotationContext. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageAnnotationContext. - * @implements IImageAnnotationContext - * @constructor - * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext=} [properties] Properties to set - */ - function ImageAnnotationContext(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]]; - } - - /** - * 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 - * @instance - */ - ImageAnnotationContext.prototype.pageNumber = 0; - - /** - * Creates a new ImageAnnotationContext instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext - * @static - * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext instance - */ - ImageAnnotationContext.create = function create(properties) { - return new ImageAnnotationContext(properties); - }; - - /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageAnnotationContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext - * @static - * @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 - */ - ImageAnnotationContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); - return writer; - }; - - /** - * 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.ImageAnnotationContext - * @static - * @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 - */ - ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. - * @function decode - * @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.ImageAnnotationContext} ImageAnnotationContext - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } - case 2: { - message.pageNumber = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageAnnotationContext message. - * @function verify - * @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 - */ - ImageAnnotationContext.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"; - return null; - }; - - /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext - */ - ImageAnnotationContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext) - 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; - return message; - }; - - /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext - * @static - * @param {google.cloud.vision.v1p3beta1.ImageAnnotationContext} message ImageAnnotationContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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 ImageAnnotationContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext - * @instance - * @returns {Object.} JSON object - */ - ImageAnnotationContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageAnnotationContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageAnnotationContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ImageAnnotationContext"; - }; - - return ImageAnnotationContext; - })(); - - v1p3beta1.AnnotateImageResponse = (function() { - - /** - * Properties of an AnnotateImageResponse. - * @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 - */ - - /** - * 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; - - /** - * 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 - * @instance - */ - AnnotateImageResponse.prototype.context = null; - - /** - * Creates a new AnnotateImageResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse instance - */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); - }; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.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 && Object.hasOwnProperty.call(message, "safeSearchAnnotation")) - $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && Object.hasOwnProperty.call(message, "imagePropertiesAnnotation")) - $root.google.cloud.vision.v1p3beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && Object.hasOwnProperty.call(message, "cropHintsAnnotation")) - $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && Object.hasOwnProperty.call(message, "fullTextAnnotation")) - $root.google.cloud.vision.v1p3beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && Object.hasOwnProperty.call(message, "webDetection")) - $root.google.cloud.vision.v1p3beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.productSearchResults != null && Object.hasOwnProperty.call(message, "productSearchResults")) - $root.google.cloud.vision.v1p3beta1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.context != null && Object.hasOwnProperty.call(message, "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 AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageResponse 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; - } - return null; - }; - - /** - * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse - */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1p3beta1.AnnotateImageResponse} message AnnotateImageResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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 = []; - 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); - } - return object; - }; - - /** - * Converts this AnnotateImageResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.AnnotateImageResponse"; - }; - - return AnnotateImageResponse; - })(); - - v1p3beta1.AnnotateFileResponse = (function() { - - /** - * Properties of an AnnotateFileResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IAnnotateFileResponse - * @property {google.cloud.vision.v1p3beta1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig - * @property {Array.|null} [responses] AnnotateFileResponse responses - */ - - /** - * Constructs a new AnnotateFileResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AnnotateFileResponse. - * @implements IAnnotateFileResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse=} [properties] Properties to set - */ - 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]]; - } - - /** - * AnnotateFileResponse inputConfig. - * @member {google.cloud.vision.v1p3beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse - * @instance - */ - AnnotateFileResponse.prototype.inputConfig = null; - - /** - * 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.AnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse instance - */ - AnnotateFileResponse.create = function create(properties) { - return new AnnotateFileResponse(properties); - }; - - /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateFileResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse - * @static - * @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 - */ - AnnotateFileResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateFileResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse - * @static - * @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 - */ - AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. - * @function decode - * @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.AnnotateFileResponse} AnnotateFileResponse - * @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) { - 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(); - 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()); - 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); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateFileResponse message. - * @function verify - * @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 - */ - AnnotateFileResponse.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.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 AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse - */ - AnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateFileResponse) - 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); - } - 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 AnnotateFileResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p3beta1.AnnotateFileResponse} message AnnotateFileResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateFileResponse.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); - } - return object; - }; - - /** - * Converts this AnnotateFileResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse - * @instance - * @returns {Object.} JSON object - */ - AnnotateFileResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateFileResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateFileResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.AnnotateFileResponse"; - }; - - return AnnotateFileResponse; - })(); - - v1p3beta1.BatchAnnotateImagesRequest = (function() { - - /** - * Properties of a BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests - */ - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest - * @instance - */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance - */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest - * @static - * @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 - */ - 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.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.BatchAnnotateImagesRequest - * @static - * @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 - */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateImagesRequest message. - * @function verify - * @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 - */ - 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.AnnotateImageRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } - return null; - }; - - /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchAnnotateImagesRequest.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); - } - return object; - }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest"; - }; - - return BatchAnnotateImagesRequest; - })(); - - v1p3beta1.BatchAnnotateImagesResponse = (function() { - - /** - * Properties of a BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses - */ - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse - * @instance - */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance - */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse - * @static - * @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 - */ - 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.v1p3beta1.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.v1p3beta1.BatchAnnotateImagesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse - * @static - * @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 - */ - 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.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.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.BatchAnnotateImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.BatchAnnotateImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse - */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.AnnotateImageResponse.toObject(message.responses[j], options); - } - return object; - }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse"; - }; - - return BatchAnnotateImagesResponse; - })(); - - v1p3beta1.AsyncAnnotateFileRequest = (function() { - - /** - * Properties of an AsyncAnnotateFileRequest. - * @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 - */ - - /** - * 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 - */ - 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]]; - } - - /** - * AsyncAnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1p3beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.inputConfig = null; - - /** - * AsyncAnnotateFileRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; - - /** - * 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.AsyncAnnotateFileRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance - */ - AsyncAnnotateFileRequest.create = function create(properties) { - return new AsyncAnnotateFileRequest(properties); - }; - - /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @static - * @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 - */ - AsyncAnnotateFileRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1p3beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.AsyncAnnotateFileRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @static - * @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 - */ - AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest - * @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) { - 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(); - 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()); - 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; - } - case 4: { - message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncAnnotateFileRequest message. - * @function verify - * @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 - */ - AsyncAnnotateFileRequest.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.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; - } - return null; - }; - - /** - * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest - */ - AsyncAnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest) - 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); - } - 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); - } - return message; - }; - - /** - * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @static - * @param {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncAnnotateFileRequest.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.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 AsyncAnnotateFileRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncAnnotateFileRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncAnnotateFileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest"; - }; - - return AsyncAnnotateFileRequest; - })(); - - v1p3beta1.AsyncAnnotateFileResponse = (function() { - - /** - * Properties of an AsyncAnnotateFileResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IAsyncAnnotateFileResponse - * @property {google.cloud.vision.v1p3beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig - */ - - /** - * Constructs a new AsyncAnnotateFileResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AsyncAnnotateFileResponse. - * @implements IAsyncAnnotateFileResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - */ - function AsyncAnnotateFileResponse(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]]; - } - - /** - * AsyncAnnotateFileResponse outputConfig. - * @member {google.cloud.vision.v1p3beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @instance - */ - AsyncAnnotateFileResponse.prototype.outputConfig = null; - - /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance - */ - AsyncAnnotateFileResponse.create = function create(properties) { - return new AsyncAnnotateFileResponse(properties); - }; - - /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @static - * @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 - */ - AsyncAnnotateFileResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1p3beta1.OutputConfig.encode(message.outputConfig, 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.v1p3beta1.AsyncAnnotateFileResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @static - * @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 - */ - AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. - * @function decode - * @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.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncAnnotateFileResponse message. - * @function verify - * @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 - */ - AsyncAnnotateFileResponse.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 (error) - return "outputConfig." + error; - } - return null; - }; - - /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse - */ - AsyncAnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncAnnotateFileResponse.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.v1p3beta1.OutputConfig.toObject(message.outputConfig, options); - return object; - }; - - /** - * Converts this AsyncAnnotateFileResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncAnnotateFileResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncAnnotateFileResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse"; - }; - - return AsyncAnnotateFileResponse; - })(); - - v1p3beta1.AsyncBatchAnnotateFilesRequest = (function() { - - /** - * Properties of an AsyncBatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IAsyncBatchAnnotateFilesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests - */ - - /** - * Constructs a new AsyncBatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesRequest. - * @implements IAsyncBatchAnnotateFilesRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - */ - function AsyncBatchAnnotateFilesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * AsyncBatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @instance - */ - AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; - - /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance - */ - AsyncBatchAnnotateFilesRequest.create = function create(properties) { - return new AsyncBatchAnnotateFilesRequest(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @static - * @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 - */ - 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.v1p3beta1.AsyncAnnotateFileRequest.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. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @static - * @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 - */ - AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest - * @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) { - 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(); - 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())); - 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.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncBatchAnnotateFilesRequest message. - * @function verify - * @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 - */ - 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.v1p3beta1.AsyncAnnotateFileRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } - return null; - }; - - /** - * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest - */ - AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest) - return object; - 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 an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.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); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateFilesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest"; - }; - - 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); - } - return object; - }; - - /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateFilesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse"; - }; - - return AsyncBatchAnnotateFilesResponse; - })(); - - v1p3beta1.InputConfig = (function() { - - /** - * Properties of an InputConfig. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IInputConfig - * @property {google.cloud.vision.v1p3beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource - * @property {string|null} [mimeType] InputConfig mimeType - */ - - /** - * Constructs a new InputConfig. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig - * @constructor - * @param {google.cloud.vision.v1p3beta1.IInputConfig=} [properties] Properties to set - */ - function InputConfig(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]]; - } - - /** - * 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 - * @instance - */ - InputConfig.prototype.mimeType = ""; - - /** - * Creates a new InputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.InputConfig - * @static - * @param {google.cloud.vision.v1p3beta1.IInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig instance - */ - InputConfig.create = function create(properties) { - return new InputConfig(properties); - }; - - /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.InputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.InputConfig - * @static - * @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 - */ - InputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.vision.v1p3beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); - return writer; - }; - - /** - * 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.InputConfig - * @static - * @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 - */ - 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.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.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.v1p3beta1.InputConfig(); - 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(); - 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.v1p3beta1.InputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p3beta1.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.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 an InputConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.InputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig - */ - InputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.InputConfig) - 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); - } - 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.v1p3beta1.InputConfig - * @static - * @param {google.cloud.vision.v1p3beta1.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 (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. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.InputConfig - * @instance - * @returns {Object.} JSON object - */ - InputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.InputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.InputConfig"; - }; - - return InputConfig; - })(); - - v1p3beta1.OutputConfig = (function() { - - /** - * Properties of an OutputConfig. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IOutputConfig - * @property {google.cloud.vision.v1p3beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination - * @property {number|null} [batchSize] OutputConfig batchSize - */ - - /** - * Constructs a new OutputConfig. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an OutputConfig. - * @implements IOutputConfig - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * OutputConfig gcsDestination. - * @member {google.cloud.vision.v1p3beta1.IGcsDestination|null|undefined} gcsDestination - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @instance - */ - OutputConfig.prototype.gcsDestination = null; - - /** - * OutputConfig batchSize. - * @member {number} batchSize - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @instance - */ - OutputConfig.prototype.batchSize = 0; - - /** - * Creates a new OutputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @static - * @param {google.cloud.vision.v1p3beta1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig instance - */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); - }; - - /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.OutputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @static - * @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 - */ - OutputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) - $root.google.cloud.vision.v1p3beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.batchSize != null && Object.hasOwnProperty.call(message, "batchSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); - return writer; - }; - - /** - * 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.OutputConfig - * @static - * @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 - */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OutputConfig message from the specified reader or buffer. - * @function decode - * @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.OutputConfig} OutputConfig - * @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) { - 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(); - 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()); - break; - } - case 2: { - message.batchSize = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OutputConfig message. - * @function verify - * @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 - */ - OutputConfig.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 (error) - return "gcsDestination." + 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. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig - */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.OutputConfig) - 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); - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @static - * @param {google.cloud.vision.v1p3beta1.OutputConfig} message OutputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OutputConfig.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.v1p3beta1.GcsDestination.toObject(message.gcsDestination, options); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - object.batchSize = message.batchSize; - return object; - }; - - /** - * Converts this OutputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @instance - * @returns {Object.} JSON object - */ - OutputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OutputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.OutputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.OutputConfig"; - }; - - return OutputConfig; - })(); - - v1p3beta1.GcsSource = (function() { - - /** - * Properties of a GcsSource. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri - */ - - /** - * Constructs a new GcsSource. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource - * @constructor - * @param {google.cloud.vision.v1p3beta1.IGcsSource=} [properties] Properties to set - */ - function GcsSource(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]]; - } - - /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p3beta1.GcsSource - * @instance - */ - GcsSource.prototype.uri = ""; - - /** - * Creates a new GcsSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.GcsSource - * @static - * @param {google.cloud.vision.v1p3beta1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource instance - */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); - }; - - /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.GcsSource - * @static - * @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 - */ - GcsSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - return writer; - }; - - /** - * 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.GcsSource - * @static - * @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 - */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer. - * @function decode - * @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.GcsSource} GcsSource - * @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) { - 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(); - 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; - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GcsSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GcsSource message. - * @function verify - * @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 - */ - GcsSource.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 GcsSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.GcsSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource - */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.GcsSource) - return object; - 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 GcsSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.GcsSource - * @static - * @param {google.cloud.vision.v1p3beta1.GcsSource} message GcsSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GcsSource.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; - }; - - /** - * Converts this GcsSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.GcsSource - * @instance - * @returns {Object.} JSON object - */ - GcsSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GcsSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.GcsSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.GcsSource"; - }; - - return GcsSource; - })(); - - v1p3beta1.GcsDestination = (function() { - - /** - * Properties of a GcsDestination. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri - */ - - /** - * Constructs a new GcsDestination. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a GcsDestination. - * @implements IGcsDestination - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p3beta1.GcsDestination - * @instance - */ - GcsDestination.prototype.uri = ""; - - /** - * Creates a new GcsDestination instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.GcsDestination - * @static - * @param {google.cloud.vision.v1p3beta1.IGcsDestination=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination instance - */ - GcsDestination.create = function create(properties) { - return new GcsDestination(properties); - }; - - /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsDestination.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.GcsDestination - * @static - * @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 - */ - GcsDestination.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - return writer; - }; - - /** - * 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.GcsDestination - * @static - * @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 - */ - GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GcsDestination message from the specified reader or buffer. - * @function decode - * @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.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.v1p3beta1.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; - }; - - /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GcsDestination - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - GcsDestination.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GcsDestination message. - * @function verify - * @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 - */ - 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 GcsDestination message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.GcsDestination - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination - */ - GcsDestination.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.GcsDestination) - return object; - 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 GcsDestination message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.GcsDestination - * @static - * @param {google.cloud.vision.v1p3beta1.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; - }; - - /** - * Converts this GcsDestination to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.GcsDestination - * @instance - * @returns {Object.} JSON object - */ - GcsDestination.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GcsDestination - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.GcsDestination - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GcsDestination.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.GcsDestination"; - }; - - return GcsDestination; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1p3beta1.Likelihood - * @enum {number} - * @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 an OperationMetadata. - * @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 - */ - - /** - * Constructs a new OperationMetadata. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * 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 - * @instance - */ - OperationMetadata.prototype.updateTime = null; - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @static - * @param {google.cloud.vision.v1p3beta1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata instance - */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); - }; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p3beta1.OperationMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @static - * @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 - */ - OperationMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * 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.OperationMetadata - * @static - * @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 - */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer. - * @function decode - * @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.OperationMetadata} OperationMetadata - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationMetadata message. - * @function verify - * @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 - */ - OperationMetadata.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 (error) - return "updateTime." + error; - } - return null; - }; - - /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata - */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.OperationMetadata) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.OperationMetadata(); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - 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 an OperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @static - * @param {google.cloud.vision.v1p3beta1.OperationMetadata} message OperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationMetadata.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.v1p3beta1.OperationMetadata.State[message.state] === undefined ? message.state : $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. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @instance - * @returns {Object.} JSON object - */ - OperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationMetadata - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.OperationMetadata"; - }; - - /** - * State enum. - * @name google.cloud.vision.v1p3beta1.OperationMetadata.State - * @enum {number} - * @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() { - - /** - * Properties of a ProductSearchParams. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IProductSearchParams - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] ProductSearchParams boundingPoly - * @property {string|null} [productSet] ProductSearchParams productSet - * @property {Array.|null} [productCategories] ProductSearchParams productCategories - * @property {string|null} [filter] ProductSearchParams filter - */ - - /** - * Constructs a new ProductSearchParams. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ProductSearchParams. - * @implements IProductSearchParams - * @constructor - * @param {google.cloud.vision.v1p3beta1.IProductSearchParams=} [properties] Properties to set - */ - function ProductSearchParams(properties) { - this.productCategories = []; - 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]]; - } - - /** - * ProductSearchParams boundingPoly. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.boundingPoly = null; - - /** - * ProductSearchParams productSet. - * @member {string} productSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.productSet = ""; - - /** - * ProductSearchParams productCategories. - * @member {Array.} productCategories - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.productCategories = $util.emptyArray; - - /** - * ProductSearchParams filter. - * @member {string} filter - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.filter = ""; - - /** - * Creates a new ProductSearchParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSearchParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ProductSearchParams} ProductSearchParams instance - */ - ProductSearchParams.create = function create(properties) { - return new ProductSearchParams(properties); - }; - - /** - * Encodes the specified ProductSearchParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSearchParams} message ProductSearchParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.productSet); - if (message.productCategories != null && message.productCategories.length) - for (var i = 0; i < message.productCategories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.productCategories[i]); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.filter); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSearchParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchParams.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSearchParams} message ProductSearchParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @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.ProductSearchParams} ProductSearchParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchParams.decode = function decode(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.ProductSearchParams(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 9: { - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 6: { - message.productSet = reader.string(); - break; - } - case 7: { - if (!(message.productCategories && message.productCategories.length)) - message.productCategories = []; - message.productCategories.push(reader.string()); - break; - } - case 8: { - message.filter = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ProductSearchParams} ProductSearchParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSearchParams message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSearchParams.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.productSet != null && message.hasOwnProperty("productSet")) - if (!$util.isString(message.productSet)) - return "productSet: string expected"; - if (message.productCategories != null && message.hasOwnProperty("productCategories")) { - if (!Array.isArray(message.productCategories)) - return "productCategories: array expected"; - for (var i = 0; i < message.productCategories.length; ++i) - if (!$util.isString(message.productCategories[i])) - return "productCategories: string[] expected"; - } - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - return null; - }; - - /** - * Creates a ProductSearchParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ProductSearchParams} ProductSearchParams - */ - ProductSearchParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ProductSearchParams) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ProductSearchParams(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchParams.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.productSet != null) - message.productSet = String(object.productSet); - if (object.productCategories) { - if (!Array.isArray(object.productCategories)) - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchParams.productCategories: array expected"); - message.productCategories = []; - for (var i = 0; i < object.productCategories.length; ++i) - message.productCategories[i] = String(object.productCategories[i]); - } - if (object.filter != null) - message.filter = String(object.filter); - return message; - }; - - /** - * Creates a plain object from a ProductSearchParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchParams} message ProductSearchParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSearchParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productCategories = []; - if (options.defaults) { - object.productSet = ""; - object.filter = ""; - object.boundingPoly = null; - } - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = message.productSet; - if (message.productCategories && message.productCategories.length) { - object.productCategories = []; - for (var j = 0; j < message.productCategories.length; ++j) - object.productCategories[j] = message.productCategories[j]; - } - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); - return object; - }; - - /** - * Converts this ProductSearchParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @instance - * @returns {Object.} JSON object - */ - ProductSearchParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSearchParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ProductSearchParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSearchParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ProductSearchParams"; - }; - - return ProductSearchParams; - })(); - - v1p3beta1.ProductSearchResults = (function() { - - /** - * Properties of a ProductSearchResults. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IProductSearchResults - * @property {google.protobuf.ITimestamp|null} [indexTime] ProductSearchResults indexTime - * @property {Array.|null} [results] ProductSearchResults results - * @property {Array.|null} [productGroupedResults] ProductSearchResults productGroupedResults - */ - - /** - * Constructs a new ProductSearchResults. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ProductSearchResults. - * @implements IProductSearchResults - * @constructor - * @param {google.cloud.vision.v1p3beta1.IProductSearchResults=} [properties] Properties to set - */ - function ProductSearchResults(properties) { - this.results = []; - this.productGroupedResults = []; - 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]]; - } - - /** - * ProductSearchResults indexTime. - * @member {google.protobuf.ITimestamp|null|undefined} indexTime - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.indexTime = null; - - /** - * ProductSearchResults results. - * @member {Array.} results - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.results = $util.emptyArray; - - /** - * ProductSearchResults productGroupedResults. - * @member {Array.} productGroupedResults - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.productGroupedResults = $util.emptyArray; - - /** - * Creates a new ProductSearchResults instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSearchResults=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults} ProductSearchResults instance - */ - ProductSearchResults.create = function create(properties) { - return new ProductSearchResults(properties); - }; - - /** - * Encodes the specified ProductSearchResults message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSearchResults} message ProductSearchResults message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchResults.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.indexTime != null && Object.hasOwnProperty.call(message, "indexTime")) - $root.google.protobuf.Timestamp.encode(message.indexTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.encode(message.results[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.productGroupedResults != null && message.productGroupedResults.length) - for (var i = 0; i < message.productGroupedResults.length; ++i) - $root.google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.encode(message.productGroupedResults[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSearchResults message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSearchResults} message ProductSearchResults message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchResults.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @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.ProductSearchResults} ProductSearchResults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchResults.decode = function decode(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.ProductSearchResults(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - message.indexTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.productGroupedResults && message.productGroupedResults.length)) - message.productGroupedResults = []; - message.productGroupedResults.push($root.google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults} ProductSearchResults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchResults.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSearchResults message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSearchResults.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.indexTime); - if (error) - return "indexTime." + error; - } - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.productGroupedResults != null && message.hasOwnProperty("productGroupedResults")) { - if (!Array.isArray(message.productGroupedResults)) - return "productGroupedResults: array expected"; - for (var i = 0; i < message.productGroupedResults.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.verify(message.productGroupedResults[i]); - if (error) - return "productGroupedResults." + error; - } - } - return null; - }; - - /** - * Creates a ProductSearchResults message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults} ProductSearchResults - */ - ProductSearchResults.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ProductSearchResults) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ProductSearchResults(); - if (object.indexTime != null) { - if (typeof object.indexTime !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.indexTime: object expected"); - message.indexTime = $root.google.protobuf.Timestamp.fromObject(object.indexTime); - } - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.results: object expected"); - message.results[i] = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.fromObject(object.results[i]); - } - } - if (object.productGroupedResults) { - if (!Array.isArray(object.productGroupedResults)) - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.productGroupedResults: array expected"); - message.productGroupedResults = []; - for (var i = 0; i < object.productGroupedResults.length; ++i) { - if (typeof object.productGroupedResults[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.productGroupedResults: object expected"); - message.productGroupedResults[i] = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.fromObject(object.productGroupedResults[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ProductSearchResults message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults} message ProductSearchResults - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSearchResults.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.productGroupedResults = []; - } - if (options.defaults) - object.indexTime = null; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) - object.indexTime = $root.google.protobuf.Timestamp.toObject(message.indexTime, options); - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.toObject(message.results[j], options); - } - if (message.productGroupedResults && message.productGroupedResults.length) { - object.productGroupedResults = []; - for (var j = 0; j < message.productGroupedResults.length; ++j) - object.productGroupedResults[j] = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.toObject(message.productGroupedResults[j], options); - } - return object; - }; - - /** - * Converts this ProductSearchResults to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @instance - * @returns {Object.} JSON object - */ - ProductSearchResults.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSearchResults - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSearchResults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ProductSearchResults"; - }; - - ProductSearchResults.Result = (function() { - - /** - * Properties of a Result. - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @interface IResult - * @property {google.cloud.vision.v1p3beta1.IProduct|null} [product] Result product - * @property {number|null} [score] Result score - * @property {string|null} [image] Result image - */ - - /** - * Constructs a new Result. - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @classdesc Represents a Result. - * @implements IResult - * @constructor - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IResult=} [properties] Properties to set - */ - function Result(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]]; - } - - /** - * Result product. - * @member {google.cloud.vision.v1p3beta1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @instance - */ - Result.prototype.product = null; - - /** - * Result score. - * @member {number} score - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @instance - */ - Result.prototype.score = 0; - - /** - * Result image. - * @member {string} image - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @instance - */ - Result.prototype.image = ""; - - /** - * Creates a new Result instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IResult=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.Result} Result instance - */ - Result.create = function create(properties) { - return new Result(properties); - }; - - /** - * Encodes the specified Result message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.Result.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IResult} message Result message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Result.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1p3beta1.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.image != null && Object.hasOwnProperty.call(message, "image")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.image); - return writer; - }; - - /** - * Encodes the specified Result message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.Result.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IResult} message Result message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Result.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Result message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @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.ProductSearchResults.Result} Result - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Result.decode = function decode(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.ProductSearchResults.Result(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.product = $root.google.cloud.vision.v1p3beta1.Product.decode(reader, reader.uint32()); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.image = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Result message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.Result} Result - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Result.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Result message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Result.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1p3beta1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.image != null && message.hasOwnProperty("image")) - if (!$util.isString(message.image)) - return "image: string expected"; - return null; - }; - - /** - * Creates a Result message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.Result} Result - */ - Result.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.Result.product: object expected"); - message.product = $root.google.cloud.vision.v1p3beta1.Product.fromObject(object.product); - } - if (object.score != null) - message.score = Number(object.score); - if (object.image != null) - message.image = String(object.image); - return message; - }; - - /** - * Creates a plain object from a Result message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.Result} message Result - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Result.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.score = 0; - object.image = ""; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1p3beta1.Product.toObject(message.product, options); - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.image != null && message.hasOwnProperty("image")) - object.image = message.image; - return object; - }; - - /** - * Converts this Result to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @instance - * @returns {Object.} JSON object - */ - Result.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Result - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.Result - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Result.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ProductSearchResults.Result"; - }; - - return Result; - })(); - - ProductSearchResults.ObjectAnnotation = (function() { - - /** - * Properties of an ObjectAnnotation. - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @interface IObjectAnnotation - * @property {string|null} [mid] ObjectAnnotation mid - * @property {string|null} [languageCode] ObjectAnnotation languageCode - * @property {string|null} [name] ObjectAnnotation name - * @property {number|null} [score] ObjectAnnotation score - */ - - /** - * Constructs a new ObjectAnnotation. - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @classdesc Represents an ObjectAnnotation. - * @implements IObjectAnnotation - * @constructor - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation=} [properties] Properties to set - */ - function ObjectAnnotation(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]]; - } - - /** - * ObjectAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.mid = ""; - - /** - * ObjectAnnotation languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.languageCode = ""; - - /** - * ObjectAnnotation name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.name = ""; - - /** - * ObjectAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.score = 0; - - /** - * Creates a new ObjectAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation instance - */ - ObjectAnnotation.create = function create(properties) { - return new ObjectAnnotation(properties); - }; - - /** - * Encodes the specified ObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation} message ObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ObjectAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - return writer; - }; - - /** - * Encodes the specified ObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IObjectAnnotation} message ObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ObjectAnnotation.decode = function decode(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.ProductSearchResults.ObjectAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ObjectAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ObjectAnnotation.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"; - return null; - }; - - /** - * Creates an ObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - */ - ObjectAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation(); - 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); - return message; - }; - - /** - * Creates a plain object from an ObjectAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation} message ObjectAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ObjectAnnotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.mid = ""; - object.languageCode = ""; - object.name = ""; - object.score = 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; - return object; - }; - - /** - * Converts this ObjectAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @instance - * @returns {Object.} JSON object - */ - ObjectAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ObjectAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ObjectAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation"; - }; - - return ObjectAnnotation; - })(); - - ProductSearchResults.GroupedResult = (function() { - - /** - * Properties of a GroupedResult. - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @interface IGroupedResult - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] GroupedResult boundingPoly - * @property {Array.|null} [results] GroupedResult results - * @property {Array.|null} [objectAnnotations] GroupedResult objectAnnotations - */ - - /** - * Constructs a new GroupedResult. - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults - * @classdesc Represents a GroupedResult. - * @implements IGroupedResult - * @constructor - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult=} [properties] Properties to set - */ - function GroupedResult(properties) { - this.results = []; - this.objectAnnotations = []; - 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]]; - } - - /** - * GroupedResult boundingPoly. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.boundingPoly = null; - - /** - * GroupedResult results. - * @member {Array.} results - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.results = $util.emptyArray; - - /** - * GroupedResult objectAnnotations. - * @member {Array.} objectAnnotations - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.objectAnnotations = $util.emptyArray; - - /** - * Creates a new GroupedResult instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult} GroupedResult instance - */ - GroupedResult.create = function create(properties) { - return new GroupedResult(properties); - }; - - /** - * Encodes the specified GroupedResult message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult} message GroupedResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GroupedResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.encode(message.results[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.objectAnnotations != null && message.objectAnnotations.length) - for (var i = 0; i < message.objectAnnotations.length; ++i) - $root.google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.encode(message.objectAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GroupedResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.IGroupedResult} message GroupedResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GroupedResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GroupedResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @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.ProductSearchResults.GroupedResult} GroupedResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GroupedResult.decode = function decode(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.ProductSearchResults.GroupedResult(); - 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: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.objectAnnotations && message.objectAnnotations.length)) - message.objectAnnotations = []; - message.objectAnnotations.push($root.google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GroupedResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult} GroupedResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GroupedResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GroupedResult message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GroupedResult.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.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.objectAnnotations != null && message.hasOwnProperty("objectAnnotations")) { - if (!Array.isArray(message.objectAnnotations)) - return "objectAnnotations: array expected"; - for (var i = 0; i < message.objectAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.verify(message.objectAnnotations[i]); - if (error) - return "objectAnnotations." + error; - } - } - return null; - }; - - /** - * Creates a GroupedResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult} GroupedResult - */ - GroupedResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.results: object expected"); - message.results[i] = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.fromObject(object.results[i]); - } - } - if (object.objectAnnotations) { - if (!Array.isArray(object.objectAnnotations)) - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.objectAnnotations: array expected"); - message.objectAnnotations = []; - for (var i = 0; i < object.objectAnnotations.length; ++i) { - if (typeof object.objectAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult.objectAnnotations: object expected"); - message.objectAnnotations[i] = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.fromObject(object.objectAnnotations[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GroupedResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult} message GroupedResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GroupedResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.objectAnnotations = []; - } - if (options.defaults) - object.boundingPoly = null; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.Result.toObject(message.results[j], options); - } - if (message.objectAnnotations && message.objectAnnotations.length) { - object.objectAnnotations = []; - for (var j = 0; j < message.objectAnnotations.length; ++j) - object.objectAnnotations[j] = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.ObjectAnnotation.toObject(message.objectAnnotations[j], options); - } - return object; - }; - - /** - * Converts this GroupedResult to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @instance - * @returns {Object.} JSON object - */ - GroupedResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GroupedResult - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GroupedResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ProductSearchResults.GroupedResult"; - }; - - return GroupedResult; - })(); - - return ProductSearchResults; - })(); - - v1p3beta1.ProductSearch = (function() { - - /** - * Constructs a new ProductSearch service. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ProductSearch - * @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 ProductSearch(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ProductSearch.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductSearch; - - /** - * Creates new ProductSearch service using the specified rpc implementation. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @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 {ProductSearch} RPC service. Useful where requests and/or responses are streamed. - */ - ProductSearch.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|createProductSet}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef CreateProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ProductSet} [response] ProductSet - */ - - /** - * Calls CreateProductSet. - * @function createProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.ICreateProductSetRequest} request CreateProductSetRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.CreateProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createProductSet = function createProductSet(request, callback) { - return this.rpcCall(createProductSet, $root.google.cloud.vision.v1p3beta1.CreateProductSetRequest, $root.google.cloud.vision.v1p3beta1.ProductSet, request, callback); - }, "name", { value: "CreateProductSet" }); - - /** - * Calls CreateProductSet. - * @function createProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.ICreateProductSetRequest} request CreateProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|listProductSets}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef ListProductSetsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ListProductSetsResponse} [response] ListProductSetsResponse - */ - - /** - * Calls ListProductSets. - * @function listProductSets - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IListProductSetsRequest} request ListProductSetsRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.ListProductSetsCallback} callback Node-style callback called with the error, if any, and ListProductSetsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProductSets = function listProductSets(request, callback) { - return this.rpcCall(listProductSets, $root.google.cloud.vision.v1p3beta1.ListProductSetsRequest, $root.google.cloud.vision.v1p3beta1.ListProductSetsResponse, request, callback); - }, "name", { value: "ListProductSets" }); - - /** - * Calls ListProductSets. - * @function listProductSets - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IListProductSetsRequest} request ListProductSetsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|getProductSet}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef GetProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ProductSet} [response] ProductSet - */ - - /** - * Calls GetProductSet. - * @function getProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IGetProductSetRequest} request GetProductSetRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.GetProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getProductSet = function getProductSet(request, callback) { - return this.rpcCall(getProductSet, $root.google.cloud.vision.v1p3beta1.GetProductSetRequest, $root.google.cloud.vision.v1p3beta1.ProductSet, request, callback); - }, "name", { value: "GetProductSet" }); - - /** - * Calls GetProductSet. - * @function getProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IGetProductSetRequest} request GetProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|updateProductSet}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef UpdateProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ProductSet} [response] ProductSet - */ - - /** - * Calls UpdateProductSet. - * @function updateProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IUpdateProductSetRequest} request UpdateProductSetRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.UpdateProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.updateProductSet = function updateProductSet(request, callback) { - return this.rpcCall(updateProductSet, $root.google.cloud.vision.v1p3beta1.UpdateProductSetRequest, $root.google.cloud.vision.v1p3beta1.ProductSet, request, callback); - }, "name", { value: "UpdateProductSet" }); - - /** - * Calls UpdateProductSet. - * @function updateProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IUpdateProductSetRequest} request UpdateProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|deleteProductSet}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef DeleteProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProductSet. - * @function deleteProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IDeleteProductSetRequest} request DeleteProductSetRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.DeleteProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteProductSet = function deleteProductSet(request, callback) { - return this.rpcCall(deleteProductSet, $root.google.cloud.vision.v1p3beta1.DeleteProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProductSet" }); - - /** - * Calls DeleteProductSet. - * @function deleteProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IDeleteProductSetRequest} request DeleteProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|createProduct}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.Product} [response] Product - */ - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.vision.v1p3beta1.CreateProductRequest, $root.google.cloud.vision.v1p3beta1.Product, request, callback); - }, "name", { value: "CreateProduct" }); - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|listProducts}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef ListProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ListProductsResponse} [response] ListProductsResponse - */ - - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IListProductsRequest} request ListProductsRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProducts = function listProducts(request, callback) { - return this.rpcCall(listProducts, $root.google.cloud.vision.v1p3beta1.ListProductsRequest, $root.google.cloud.vision.v1p3beta1.ListProductsResponse, request, callback); - }, "name", { value: "ListProducts" }); - - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IListProductsRequest} request ListProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|getProduct}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.Product} [response] Product - */ - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.vision.v1p3beta1.GetProductRequest, $root.google.cloud.vision.v1p3beta1.Product, request, callback); - }, "name", { value: "GetProduct" }); - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|updateProduct}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.Product} [response] Product - */ - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.vision.v1p3beta1.UpdateProductRequest, $root.google.cloud.vision.v1p3beta1.Product, request, callback); - }, "name", { value: "UpdateProduct" }); - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|deleteProduct}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.vision.v1p3beta1.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|createReferenceImage}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef CreateReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ReferenceImage} [response] ReferenceImage - */ - - /** - * Calls CreateReferenceImage. - * @function createReferenceImage - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest} request CreateReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.CreateReferenceImageCallback} callback Node-style callback called with the error, if any, and ReferenceImage - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createReferenceImage = function createReferenceImage(request, callback) { - return this.rpcCall(createReferenceImage, $root.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest, $root.google.cloud.vision.v1p3beta1.ReferenceImage, request, callback); - }, "name", { value: "CreateReferenceImage" }); - - /** - * Calls CreateReferenceImage. - * @function createReferenceImage - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest} request CreateReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|deleteReferenceImage}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef DeleteReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteReferenceImage. - * @function deleteReferenceImage - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest} request DeleteReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.DeleteReferenceImageCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteReferenceImage = function deleteReferenceImage(request, callback) { - return this.rpcCall(deleteReferenceImage, $root.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteReferenceImage" }); - - /** - * Calls DeleteReferenceImage. - * @function deleteReferenceImage - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest} request DeleteReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|listReferenceImages}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef ListReferenceImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ListReferenceImagesResponse} [response] ListReferenceImagesResponse - */ - - /** - * Calls ListReferenceImages. - * @function listReferenceImages - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesRequest} request ListReferenceImagesRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.ListReferenceImagesCallback} callback Node-style callback called with the error, if any, and ListReferenceImagesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listReferenceImages = function listReferenceImages(request, callback) { - return this.rpcCall(listReferenceImages, $root.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest, $root.google.cloud.vision.v1p3beta1.ListReferenceImagesResponse, request, callback); - }, "name", { value: "ListReferenceImages" }); - - /** - * Calls ListReferenceImages. - * @function listReferenceImages - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesRequest} request ListReferenceImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|getReferenceImage}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef GetReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ReferenceImage} [response] ReferenceImage - */ - - /** - * Calls GetReferenceImage. - * @function getReferenceImage - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IGetReferenceImageRequest} request GetReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.GetReferenceImageCallback} callback Node-style callback called with the error, if any, and ReferenceImage - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getReferenceImage = function getReferenceImage(request, callback) { - return this.rpcCall(getReferenceImage, $root.google.cloud.vision.v1p3beta1.GetReferenceImageRequest, $root.google.cloud.vision.v1p3beta1.ReferenceImage, request, callback); - }, "name", { value: "GetReferenceImage" }); - - /** - * Calls GetReferenceImage. - * @function getReferenceImage - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IGetReferenceImageRequest} request GetReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|addProductToProductSet}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef AddProductToProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls AddProductToProductSet. - * @function addProductToProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest} request AddProductToProductSetRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.AddProductToProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.addProductToProductSet = function addProductToProductSet(request, callback) { - return this.rpcCall(addProductToProductSet, $root.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "AddProductToProductSet" }); - - /** - * Calls AddProductToProductSet. - * @function addProductToProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest} request AddProductToProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|removeProductFromProductSet}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef RemoveProductFromProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls RemoveProductFromProductSet. - * @function removeProductFromProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest} request RemoveProductFromProductSetRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.RemoveProductFromProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.removeProductFromProductSet = function removeProductFromProductSet(request, callback) { - return this.rpcCall(removeProductFromProductSet, $root.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "RemoveProductFromProductSet" }); - - /** - * Calls RemoveProductFromProductSet. - * @function removeProductFromProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest} request RemoveProductFromProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|listProductsInProductSet}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef ListProductsInProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse} [response] ListProductsInProductSetResponse - */ - - /** - * Calls ListProductsInProductSet. - * @function listProductsInProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest} request ListProductsInProductSetRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.ListProductsInProductSetCallback} callback Node-style callback called with the error, if any, and ListProductsInProductSetResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProductsInProductSet = function listProductsInProductSet(request, callback) { - return this.rpcCall(listProductsInProductSet, $root.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest, $root.google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse, request, callback); - }, "name", { value: "ListProductsInProductSet" }); - - /** - * Calls ListProductsInProductSet. - * @function listProductsInProductSet - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest} request ListProductsInProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ProductSearch|importProductSets}. - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @typedef ImportProductSetsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportProductSets. - * @function importProductSets - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsRequest} request ImportProductSetsRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ProductSearch.ImportProductSetsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.importProductSets = function importProductSets(request, callback) { - return this.rpcCall(importProductSets, $root.google.cloud.vision.v1p3beta1.ImportProductSetsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProductSets" }); - - /** - * Calls ImportProductSets. - * @function importProductSets - * @memberof google.cloud.vision.v1p3beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsRequest} request ImportProductSetsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ProductSearch; - })(); - - v1p3beta1.Product = (function() { - - /** - * Properties of a Product. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IProduct - * @property {string|null} [name] Product name - * @property {string|null} [displayName] Product displayName - * @property {string|null} [description] Product description - * @property {string|null} [productCategory] Product productCategory - * @property {Array.|null} [productLabels] Product productLabels - */ - - /** - * Constructs a new Product. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Product. - * @implements IProduct - * @constructor - * @param {google.cloud.vision.v1p3beta1.IProduct=} [properties] Properties to set - */ - function Product(properties) { - this.productLabels = []; - 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]]; - } - - /** - * Product name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.Product - * @instance - */ - Product.prototype.name = ""; - - /** - * Product displayName. - * @member {string} displayName - * @memberof google.cloud.vision.v1p3beta1.Product - * @instance - */ - Product.prototype.displayName = ""; - - /** - * Product description. - * @member {string} description - * @memberof google.cloud.vision.v1p3beta1.Product - * @instance - */ - Product.prototype.description = ""; - - /** - * Product productCategory. - * @member {string} productCategory - * @memberof google.cloud.vision.v1p3beta1.Product - * @instance - */ - Product.prototype.productCategory = ""; - - /** - * Product productLabels. - * @member {Array.} productLabels - * @memberof google.cloud.vision.v1p3beta1.Product - * @instance - */ - Product.prototype.productLabels = $util.emptyArray; - - /** - * Creates a new Product instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Product - * @static - * @param {google.cloud.vision.v1p3beta1.IProduct=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Product} Product instance - */ - Product.create = function create(properties) { - return new Product(properties); - }; - - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Product.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Product - * @static - * @param {google.cloud.vision.v1p3beta1.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Product.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.productCategory != null && Object.hasOwnProperty.call(message, "productCategory")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.productCategory); - if (message.productLabels != null && message.productLabels.length) - for (var i = 0; i < message.productLabels.length; ++i) - $root.google.cloud.vision.v1p3beta1.Product.KeyValue.encode(message.productLabels[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Product.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Product - * @static - * @param {google.cloud.vision.v1p3beta1.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Product.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Product message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.Product - * @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.Product} Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Product.decode = function decode(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.Product(); - 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; - } - case 4: { - message.productCategory = reader.string(); - break; - } - case 5: { - if (!(message.productLabels && message.productLabels.length)) - message.productLabels = []; - message.productLabels.push($root.google.cloud.vision.v1p3beta1.Product.KeyValue.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Product - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Product} Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Product.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Product message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.Product - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Product.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.productCategory != null && message.hasOwnProperty("productCategory")) - if (!$util.isString(message.productCategory)) - return "productCategory: string expected"; - if (message.productLabels != null && message.hasOwnProperty("productLabels")) { - if (!Array.isArray(message.productLabels)) - return "productLabels: array expected"; - for (var i = 0; i < message.productLabels.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.Product.KeyValue.verify(message.productLabels[i]); - if (error) - return "productLabels." + error; - } - } - return null; - }; - - /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Product - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Product} Product - */ - Product.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Product) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.Product(); - 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); - if (object.productCategory != null) - message.productCategory = String(object.productCategory); - if (object.productLabels) { - if (!Array.isArray(object.productLabels)) - throw TypeError(".google.cloud.vision.v1p3beta1.Product.productLabels: array expected"); - message.productLabels = []; - for (var i = 0; i < object.productLabels.length; ++i) { - if (typeof object.productLabels[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Product.productLabels: object expected"); - message.productLabels[i] = $root.google.cloud.vision.v1p3beta1.Product.KeyValue.fromObject(object.productLabels[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Product - * @static - * @param {google.cloud.vision.v1p3beta1.Product} message Product - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Product.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productLabels = []; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.description = ""; - object.productCategory = ""; - } - 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; - if (message.productCategory != null && message.hasOwnProperty("productCategory")) - object.productCategory = message.productCategory; - if (message.productLabels && message.productLabels.length) { - object.productLabels = []; - for (var j = 0; j < message.productLabels.length; ++j) - object.productLabels[j] = $root.google.cloud.vision.v1p3beta1.Product.KeyValue.toObject(message.productLabels[j], options); - } - return object; - }; - - /** - * Converts this Product to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Product - * @instance - * @returns {Object.} JSON object - */ - Product.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Product - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Product - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Product.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Product"; - }; - - Product.KeyValue = (function() { - - /** - * Properties of a KeyValue. - * @memberof google.cloud.vision.v1p3beta1.Product - * @interface IKeyValue - * @property {string|null} [key] KeyValue key - * @property {string|null} [value] KeyValue value - */ - - /** - * Constructs a new KeyValue. - * @memberof google.cloud.vision.v1p3beta1.Product - * @classdesc Represents a KeyValue. - * @implements IKeyValue - * @constructor - * @param {google.cloud.vision.v1p3beta1.Product.IKeyValue=} [properties] Properties to set - */ - function KeyValue(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]]; - } - - /** - * KeyValue key. - * @member {string} key - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @instance - */ - KeyValue.prototype.key = ""; - - /** - * KeyValue value. - * @member {string} value - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @instance - */ - KeyValue.prototype.value = ""; - - /** - * Creates a new KeyValue instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1p3beta1.Product.IKeyValue=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Product.KeyValue} KeyValue instance - */ - KeyValue.create = function create(properties) { - return new KeyValue(properties); - }; - - /** - * Encodes the specified KeyValue message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Product.KeyValue.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1p3beta1.Product.IKeyValue} message KeyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Product.KeyValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1p3beta1.Product.IKeyValue} message KeyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a KeyValue message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @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.Product.KeyValue} KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValue.decode = function decode(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.Product.KeyValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.key = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a KeyValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Product.KeyValue} KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a KeyValue message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - KeyValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a KeyValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Product.KeyValue} KeyValue - */ - KeyValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Product.KeyValue) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.Product.KeyValue(); - if (object.key != null) - message.key = String(object.key); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a KeyValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1p3beta1.Product.KeyValue} message KeyValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - KeyValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.key = ""; - object.value = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this KeyValue to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @instance - * @returns {Object.} JSON object - */ - KeyValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for KeyValue - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Product.KeyValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - KeyValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Product.KeyValue"; - }; - - return KeyValue; - })(); - - return Product; - })(); - - v1p3beta1.ProductSet = (function() { - - /** - * Properties of a ProductSet. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IProductSet - * @property {string|null} [name] ProductSet name - * @property {string|null} [displayName] ProductSet displayName - * @property {google.protobuf.ITimestamp|null} [indexTime] ProductSet indexTime - * @property {google.rpc.IStatus|null} [indexError] ProductSet indexError - */ - - /** - * Constructs a new ProductSet. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ProductSet. - * @implements IProductSet - * @constructor - * @param {google.cloud.vision.v1p3beta1.IProductSet=} [properties] Properties to set - */ - function ProductSet(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]]; - } - - /** - * ProductSet name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @instance - */ - ProductSet.prototype.name = ""; - - /** - * ProductSet displayName. - * @member {string} displayName - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @instance - */ - ProductSet.prototype.displayName = ""; - - /** - * ProductSet indexTime. - * @member {google.protobuf.ITimestamp|null|undefined} indexTime - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @instance - */ - ProductSet.prototype.indexTime = null; - - /** - * ProductSet indexError. - * @member {google.rpc.IStatus|null|undefined} indexError - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @instance - */ - ProductSet.prototype.indexError = null; - - /** - * Creates a new ProductSet instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSet=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ProductSet} ProductSet instance - */ - ProductSet.create = function create(properties) { - return new ProductSet(properties); - }; - - /** - * Encodes the specified ProductSet message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSet.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSet} message ProductSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.indexTime != null && Object.hasOwnProperty.call(message, "indexTime")) - $root.google.protobuf.Timestamp.encode(message.indexTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.indexError != null && Object.hasOwnProperty.call(message, "indexError")) - $root.google.rpc.Status.encode(message.indexError, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSet message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ProductSet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @static - * @param {google.cloud.vision.v1p3beta1.IProductSet} message ProductSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @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.ProductSet} ProductSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSet.decode = function decode(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.ProductSet(); - 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.indexTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 4: { - message.indexError = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ProductSet} ProductSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSet message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSet.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.indexTime != null && message.hasOwnProperty("indexTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.indexTime); - if (error) - return "indexTime." + error; - } - if (message.indexError != null && message.hasOwnProperty("indexError")) { - var error = $root.google.rpc.Status.verify(message.indexError); - if (error) - return "indexError." + error; - } - return null; - }; - - /** - * Creates a ProductSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ProductSet} ProductSet - */ - ProductSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ProductSet) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ProductSet(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.indexTime != null) { - if (typeof object.indexTime !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSet.indexTime: object expected"); - message.indexTime = $root.google.protobuf.Timestamp.fromObject(object.indexTime); - } - if (object.indexError != null) { - if (typeof object.indexError !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ProductSet.indexError: object expected"); - message.indexError = $root.google.rpc.Status.fromObject(object.indexError); - } - return message; - }; - - /** - * Creates a plain object from a ProductSet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @static - * @param {google.cloud.vision.v1p3beta1.ProductSet} message ProductSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.indexTime = null; - object.indexError = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) - object.indexTime = $root.google.protobuf.Timestamp.toObject(message.indexTime, options); - if (message.indexError != null && message.hasOwnProperty("indexError")) - object.indexError = $root.google.rpc.Status.toObject(message.indexError, options); - return object; - }; - - /** - * Converts this ProductSet to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @instance - * @returns {Object.} JSON object - */ - ProductSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSet - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ProductSet - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ProductSet"; - }; - - return ProductSet; - })(); - - v1p3beta1.ReferenceImage = (function() { - - /** - * Properties of a ReferenceImage. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IReferenceImage - * @property {string|null} [name] ReferenceImage name - * @property {string|null} [uri] ReferenceImage uri - * @property {Array.|null} [boundingPolys] ReferenceImage boundingPolys - */ - - /** - * Constructs a new ReferenceImage. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ReferenceImage. - * @implements IReferenceImage - * @constructor - * @param {google.cloud.vision.v1p3beta1.IReferenceImage=} [properties] Properties to set - */ - function ReferenceImage(properties) { - this.boundingPolys = []; - 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]]; - } - - /** - * ReferenceImage name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.name = ""; - - /** - * ReferenceImage uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.uri = ""; - - /** - * ReferenceImage boundingPolys. - * @member {Array.} boundingPolys - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.boundingPolys = $util.emptyArray; - - /** - * Creates a new ReferenceImage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @static - * @param {google.cloud.vision.v1p3beta1.IReferenceImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ReferenceImage} ReferenceImage instance - */ - ReferenceImage.create = function create(properties) { - return new ReferenceImage(properties); - }; - - /** - * Encodes the specified ReferenceImage message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ReferenceImage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @static - * @param {google.cloud.vision.v1p3beta1.IReferenceImage} message ReferenceImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReferenceImage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); - if (message.boundingPolys != null && message.boundingPolys.length) - for (var i = 0; i < message.boundingPolys.length; ++i) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPolys[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ReferenceImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ReferenceImage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @static - * @param {google.cloud.vision.v1p3beta1.IReferenceImage} message ReferenceImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReferenceImage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @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.ReferenceImage} ReferenceImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReferenceImage.decode = function decode(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.ReferenceImage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.uri = reader.string(); - break; - } - case 3: { - if (!(message.boundingPolys && message.boundingPolys.length)) - message.boundingPolys = []; - message.boundingPolys.push($root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ReferenceImage} ReferenceImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReferenceImage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReferenceImage message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReferenceImage.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.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.boundingPolys != null && message.hasOwnProperty("boundingPolys")) { - if (!Array.isArray(message.boundingPolys)) - return "boundingPolys: array expected"; - for (var i = 0; i < message.boundingPolys.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPolys[i]); - if (error) - return "boundingPolys." + error; - } - } - return null; - }; - - /** - * Creates a ReferenceImage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ReferenceImage} ReferenceImage - */ - ReferenceImage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ReferenceImage) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ReferenceImage(); - if (object.name != null) - message.name = String(object.name); - if (object.uri != null) - message.uri = String(object.uri); - if (object.boundingPolys) { - if (!Array.isArray(object.boundingPolys)) - throw TypeError(".google.cloud.vision.v1p3beta1.ReferenceImage.boundingPolys: array expected"); - message.boundingPolys = []; - for (var i = 0; i < object.boundingPolys.length; ++i) { - if (typeof object.boundingPolys[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ReferenceImage.boundingPolys: object expected"); - message.boundingPolys[i] = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPolys[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ReferenceImage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @static - * @param {google.cloud.vision.v1p3beta1.ReferenceImage} message ReferenceImage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReferenceImage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.boundingPolys = []; - if (options.defaults) { - object.name = ""; - object.uri = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.boundingPolys && message.boundingPolys.length) { - object.boundingPolys = []; - for (var j = 0; j < message.boundingPolys.length; ++j) - object.boundingPolys[j] = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPolys[j], options); - } - return object; - }; - - /** - * Converts this ReferenceImage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @instance - * @returns {Object.} JSON object - */ - ReferenceImage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReferenceImage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ReferenceImage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReferenceImage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ReferenceImage"; - }; - - return ReferenceImage; - })(); - - v1p3beta1.CreateProductRequest = (function() { - - /** - * Properties of a CreateProductRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.vision.v1p3beta1.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId - */ - - /** - * Constructs a new CreateProductRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.ICreateProductRequest=} [properties] Properties to set - */ - function CreateProductRequest(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]]; - } - - /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.parent = ""; - - /** - * CreateProductRequest product. - * @member {google.cloud.vision.v1p3beta1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.product = null; - - /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.productId = ""; - - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CreateProductRequest} CreateProductRequest instance - */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); - }; - - /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1p3beta1.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); - return writer; - }; - - /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @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.CreateProductRequest} CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductRequest.decode = function decode(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.CreateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.product = $root.google.cloud.vision.v1p3beta1.Product.decode(reader, reader.uint32()); - break; - } - case 3: { - message.productId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.CreateProductRequest} CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1p3beta1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; - return null; - }; - - /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CreateProductRequest} CreateProductRequest - */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CreateProductRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.vision.v1p3beta1.Product.fromObject(object.product); - } - if (object.productId != null) - message.productId = String(object.productId); - return message; - }; - - /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.CreateProductRequest} message CreateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1p3beta1.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; - return object; - }; - - /** - * Converts this CreateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @instance - * @returns {Object.} JSON object - */ - CreateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.CreateProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.CreateProductRequest"; - }; - - return CreateProductRequest; - })(); - - v1p3beta1.ListProductsRequest = (function() { - - /** - * Properties of a ListProductsRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IListProductsRequest - * @property {string|null} [parent] ListProductsRequest parent - * @property {number|null} [pageSize] ListProductsRequest pageSize - * @property {string|null} [pageToken] ListProductsRequest pageToken - */ - - /** - * Constructs a new ListProductsRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ListProductsRequest. - * @implements IListProductsRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IListProductsRequest=} [properties] Properties to set - */ - function ListProductsRequest(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]]; - } - - /** - * ListProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.parent = ""; - - /** - * ListProductsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageSize = 0; - - /** - * ListProductsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ListProductsRequest} ListProductsRequest instance - */ - ListProductsRequest.create = function create(properties) { - return new ListProductsRequest(properties); - }; - - /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsRequest} message ListProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsRequest} message ListProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @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.ListProductsRequest} ListProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsRequest.decode = function decode(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.ListProductsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ListProductsRequest} ListProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ListProductsRequest} ListProductsRequest - */ - ListProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ListProductsRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ListProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ListProductsRequest} message ListProductsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ListProductsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ListProductsRequest"; - }; - - return ListProductsRequest; - })(); - - v1p3beta1.ListProductsResponse = (function() { - - /** - * Properties of a ListProductsResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IListProductsResponse - * @property {Array.|null} [products] ListProductsResponse products - * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken - */ - - /** - * Constructs a new ListProductsResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ListProductsResponse. - * @implements IListProductsResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.IListProductsResponse=} [properties] Properties to set - */ - function ListProductsResponse(properties) { - this.products = []; - 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]]; - } - - /** - * ListProductsResponse products. - * @member {Array.} products - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ListProductsResponse} ListProductsResponse instance - */ - ListProductsResponse.create = function create(properties) { - return new ListProductsResponse(properties); - }; - - /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsResponse} message ListProductsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.vision.v1p3beta1.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsResponse} message ListProductsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @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.ListProductsResponse} ListProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsResponse.decode = function decode(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.ListProductsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.vision.v1p3beta1.Product.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ListProductsResponse} ListProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsResponse message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ListProductsResponse} ListProductsResponse - */ - ListProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ListProductsResponse) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ListProductsResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.vision.v1p3beta1.ListProductsResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ListProductsResponse.products: object expected"); - message.products[i] = $root.google.cloud.vision.v1p3beta1.Product.fromObject(object.products[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.ListProductsResponse} message ListProductsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.vision.v1p3beta1.Product.toObject(message.products[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ListProductsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ListProductsResponse"; - }; - - return ListProductsResponse; - })(); - - v1p3beta1.GetProductRequest = (function() { - - /** - * Properties of a GetProductRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name - */ - - /** - * Constructs a new GetProductRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IGetProductRequest=} [properties] Properties to set - */ - function GetProductRequest(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]]; - } - - /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @instance - */ - GetProductRequest.prototype.name = ""; - - /** - * Creates a new GetProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.GetProductRequest} GetProductRequest instance - */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); - }; - - /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetProductRequest} message GetProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetProductRequest} message GetProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @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.GetProductRequest} GetProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductRequest.decode = function decode(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.GetProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.GetProductRequest} GetProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.GetProductRequest} GetProductRequest - */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.GetProductRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.GetProductRequest} message GetProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @instance - * @returns {Object.} JSON object - */ - GetProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.GetProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.GetProductRequest"; - }; - - return GetProductRequest; - })(); - - v1p3beta1.UpdateProductRequest = (function() { - - /** - * Properties of an UpdateProductRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IUpdateProductRequest - * @property {google.cloud.vision.v1p3beta1.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask - */ - - /** - * Constructs a new UpdateProductRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IUpdateProductRequest=} [properties] Properties to set - */ - function UpdateProductRequest(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]]; - } - - /** - * UpdateProductRequest product. - * @member {google.cloud.vision.v1p3beta1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.product = null; - - /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.UpdateProductRequest} UpdateProductRequest instance - */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); - }; - - /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.UpdateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1p3beta1.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.UpdateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @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.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductRequest.decode = function decode(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.UpdateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.product = $root.google.cloud.vision.v1p3beta1.Product.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UpdateProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1p3beta1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; - - /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.UpdateProductRequest} UpdateProductRequest - */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.UpdateProductRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.vision.v1p3beta1.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; - - /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.UpdateProductRequest} message UpdateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1p3beta1.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; - - /** - * Converts this UpdateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdateProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.UpdateProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.UpdateProductRequest"; - }; - - return UpdateProductRequest; - })(); - - v1p3beta1.DeleteProductRequest = (function() { - - /** - * Properties of a DeleteProductRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name - */ - - /** - * Constructs a new DeleteProductRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IDeleteProductRequest=} [properties] Properties to set - */ - function DeleteProductRequest(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]]; - } - - /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @instance - */ - DeleteProductRequest.prototype.name = ""; - - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.DeleteProductRequest} DeleteProductRequest instance - */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); - }; - - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @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.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decode = function decode(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.DeleteProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.DeleteProductRequest} DeleteProductRequest - */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.DeleteProductRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1p3beta1.DeleteProductRequest} message DeleteProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.DeleteProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.DeleteProductRequest"; - }; - - return DeleteProductRequest; - })(); - - v1p3beta1.CreateProductSetRequest = (function() { - - /** - * Properties of a CreateProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ICreateProductSetRequest - * @property {string|null} [parent] CreateProductSetRequest parent - * @property {google.cloud.vision.v1p3beta1.IProductSet|null} [productSet] CreateProductSetRequest productSet - * @property {string|null} [productSetId] CreateProductSetRequest productSetId - */ - - /** - * Constructs a new CreateProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CreateProductSetRequest. - * @implements ICreateProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.ICreateProductSetRequest=} [properties] Properties to set - */ - function CreateProductSetRequest(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]]; - } - - /** - * CreateProductSetRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.parent = ""; - - /** - * CreateProductSetRequest productSet. - * @member {google.cloud.vision.v1p3beta1.IProductSet|null|undefined} productSet - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.productSet = null; - - /** - * CreateProductSetRequest productSetId. - * @member {string} productSetId - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.productSetId = ""; - - /** - * Creates a new CreateProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CreateProductSetRequest} CreateProductSetRequest instance - */ - CreateProductSetRequest.create = function create(properties) { - return new CreateProductSetRequest(properties); - }; - - /** - * Encodes the specified CreateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateProductSetRequest} message CreateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - $root.google.cloud.vision.v1p3beta1.ProductSet.encode(message.productSet, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productSetId != null && Object.hasOwnProperty.call(message, "productSetId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productSetId); - return writer; - }; - - /** - * Encodes the specified CreateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateProductSetRequest} message CreateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @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.CreateProductSetRequest} CreateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductSetRequest.decode = function decode(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.CreateProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.productSet = $root.google.cloud.vision.v1p3beta1.ProductSet.decode(reader, reader.uint32()); - break; - } - case 3: { - message.productSetId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.CreateProductSetRequest} CreateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.productSet != null && message.hasOwnProperty("productSet")) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSet.verify(message.productSet); - if (error) - return "productSet." + error; - } - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - if (!$util.isString(message.productSetId)) - return "productSetId: string expected"; - return null; - }; - - /** - * Creates a CreateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CreateProductSetRequest} CreateProductSetRequest - */ - CreateProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CreateProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.CreateProductSetRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.productSet != null) { - if (typeof object.productSet !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.CreateProductSetRequest.productSet: object expected"); - message.productSet = $root.google.cloud.vision.v1p3beta1.ProductSet.fromObject(object.productSet); - } - if (object.productSetId != null) - message.productSetId = String(object.productSetId); - return message; - }; - - /** - * Creates a plain object from a CreateProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.CreateProductSetRequest} message CreateProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.productSet = null; - object.productSetId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = $root.google.cloud.vision.v1p3beta1.ProductSet.toObject(message.productSet, options); - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - object.productSetId = message.productSetId; - return object; - }; - - /** - * Converts this CreateProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - CreateProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.CreateProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.CreateProductSetRequest"; - }; - - return CreateProductSetRequest; - })(); - - v1p3beta1.ListProductSetsRequest = (function() { - - /** - * Properties of a ListProductSetsRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IListProductSetsRequest - * @property {string|null} [parent] ListProductSetsRequest parent - * @property {number|null} [pageSize] ListProductSetsRequest pageSize - * @property {string|null} [pageToken] ListProductSetsRequest pageToken - */ - - /** - * Constructs a new ListProductSetsRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ListProductSetsRequest. - * @implements IListProductSetsRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IListProductSetsRequest=} [properties] Properties to set - */ - function ListProductSetsRequest(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]]; - } - - /** - * ListProductSetsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.parent = ""; - - /** - * ListProductSetsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.pageSize = 0; - - /** - * ListProductSetsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductSetsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductSetsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ListProductSetsRequest} ListProductSetsRequest instance - */ - ListProductSetsRequest.create = function create(properties) { - return new ListProductSetsRequest(properties); - }; - - /** - * Encodes the specified ListProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductSetsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductSetsRequest} message ListProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductSetsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductSetsRequest} message ListProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @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.ListProductSetsRequest} ListProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsRequest.decode = function decode(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.ListProductSetsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ListProductSetsRequest} ListProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductSetsRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductSetsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ListProductSetsRequest} ListProductSetsRequest - */ - ListProductSetsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ListProductSetsRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ListProductSetsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductSetsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ListProductSetsRequest} message ListProductSetsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductSetsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductSetsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductSetsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductSetsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductSetsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ListProductSetsRequest"; - }; - - return ListProductSetsRequest; - })(); - - v1p3beta1.ListProductSetsResponse = (function() { - - /** - * Properties of a ListProductSetsResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IListProductSetsResponse - * @property {Array.|null} [productSets] ListProductSetsResponse productSets - * @property {string|null} [nextPageToken] ListProductSetsResponse nextPageToken - */ - - /** - * Constructs a new ListProductSetsResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ListProductSetsResponse. - * @implements IListProductSetsResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.IListProductSetsResponse=} [properties] Properties to set - */ - function ListProductSetsResponse(properties) { - this.productSets = []; - 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]]; - } - - /** - * ListProductSetsResponse productSets. - * @member {Array.} productSets - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @instance - */ - ListProductSetsResponse.prototype.productSets = $util.emptyArray; - - /** - * ListProductSetsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @instance - */ - ListProductSetsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductSetsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductSetsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ListProductSetsResponse} ListProductSetsResponse instance - */ - ListProductSetsResponse.create = function create(properties) { - return new ListProductSetsResponse(properties); - }; - - /** - * Encodes the specified ListProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductSetsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductSetsResponse} message ListProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSets != null && message.productSets.length) - for (var i = 0; i < message.productSets.length; ++i) - $root.google.cloud.vision.v1p3beta1.ProductSet.encode(message.productSets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductSetsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductSetsResponse} message ListProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @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.ListProductSetsResponse} ListProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsResponse.decode = function decode(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.ListProductSetsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.productSets && message.productSets.length)) - message.productSets = []; - message.productSets.push($root.google.cloud.vision.v1p3beta1.ProductSet.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ListProductSetsResponse} ListProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductSetsResponse message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductSetsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.productSets != null && message.hasOwnProperty("productSets")) { - if (!Array.isArray(message.productSets)) - return "productSets: array expected"; - for (var i = 0; i < message.productSets.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSet.verify(message.productSets[i]); - if (error) - return "productSets." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ListProductSetsResponse} ListProductSetsResponse - */ - ListProductSetsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ListProductSetsResponse) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ListProductSetsResponse(); - if (object.productSets) { - if (!Array.isArray(object.productSets)) - throw TypeError(".google.cloud.vision.v1p3beta1.ListProductSetsResponse.productSets: array expected"); - message.productSets = []; - for (var i = 0; i < object.productSets.length; ++i) { - if (typeof object.productSets[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ListProductSetsResponse.productSets: object expected"); - message.productSets[i] = $root.google.cloud.vision.v1p3beta1.ProductSet.fromObject(object.productSets[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductSetsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.ListProductSetsResponse} message ListProductSetsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductSetsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productSets = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.productSets && message.productSets.length) { - object.productSets = []; - for (var j = 0; j < message.productSets.length; ++j) - object.productSets[j] = $root.google.cloud.vision.v1p3beta1.ProductSet.toObject(message.productSets[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductSetsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductSetsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductSetsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ListProductSetsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductSetsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ListProductSetsResponse"; - }; - - return ListProductSetsResponse; - })(); - - v1p3beta1.GetProductSetRequest = (function() { - - /** - * Properties of a GetProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IGetProductSetRequest - * @property {string|null} [name] GetProductSetRequest name - */ - - /** - * Constructs a new GetProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a GetProductSetRequest. - * @implements IGetProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IGetProductSetRequest=} [properties] Properties to set - */ - function GetProductSetRequest(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]]; - } - - /** - * GetProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @instance - */ - GetProductSetRequest.prototype.name = ""; - - /** - * Creates a new GetProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.GetProductSetRequest} GetProductSetRequest instance - */ - GetProductSetRequest.create = function create(properties) { - return new GetProductSetRequest(properties); - }; - - /** - * Encodes the specified GetProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetProductSetRequest} message GetProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetProductSetRequest} message GetProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @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.GetProductSetRequest} GetProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductSetRequest.decode = function decode(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.GetProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.GetProductSetRequest} GetProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.GetProductSetRequest} GetProductSetRequest - */ - GetProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.GetProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.GetProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.GetProductSetRequest} message GetProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - GetProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.GetProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.GetProductSetRequest"; - }; - - return GetProductSetRequest; - })(); - - v1p3beta1.UpdateProductSetRequest = (function() { - - /** - * Properties of an UpdateProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IUpdateProductSetRequest - * @property {google.cloud.vision.v1p3beta1.IProductSet|null} [productSet] UpdateProductSetRequest productSet - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductSetRequest updateMask - */ - - /** - * Constructs a new UpdateProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an UpdateProductSetRequest. - * @implements IUpdateProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IUpdateProductSetRequest=} [properties] Properties to set - */ - function UpdateProductSetRequest(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]]; - } - - /** - * UpdateProductSetRequest productSet. - * @member {google.cloud.vision.v1p3beta1.IProductSet|null|undefined} productSet - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @instance - */ - UpdateProductSetRequest.prototype.productSet = null; - - /** - * UpdateProductSetRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @instance - */ - UpdateProductSetRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IUpdateProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.UpdateProductSetRequest} UpdateProductSetRequest instance - */ - UpdateProductSetRequest.create = function create(properties) { - return new UpdateProductSetRequest(properties); - }; - - /** - * Encodes the specified UpdateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.UpdateProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IUpdateProductSetRequest} message UpdateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - $root.google.cloud.vision.v1p3beta1.ProductSet.encode(message.productSet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.UpdateProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IUpdateProductSetRequest} message UpdateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @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.UpdateProductSetRequest} UpdateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductSetRequest.decode = function decode(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.UpdateProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.productSet = $root.google.cloud.vision.v1p3beta1.ProductSet.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.UpdateProductSetRequest} UpdateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UpdateProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.productSet != null && message.hasOwnProperty("productSet")) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSet.verify(message.productSet); - if (error) - return "productSet." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; - - /** - * Creates an UpdateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.UpdateProductSetRequest} UpdateProductSetRequest - */ - UpdateProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.UpdateProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.UpdateProductSetRequest(); - if (object.productSet != null) { - if (typeof object.productSet !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.UpdateProductSetRequest.productSet: object expected"); - message.productSet = $root.google.cloud.vision.v1p3beta1.ProductSet.fromObject(object.productSet); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.UpdateProductSetRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; - - /** - * Creates a plain object from an UpdateProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.UpdateProductSetRequest} message UpdateProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.productSet = null; - object.updateMask = null; - } - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = $root.google.cloud.vision.v1p3beta1.ProductSet.toObject(message.productSet, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; - - /** - * Converts this UpdateProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdateProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.UpdateProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdateProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.UpdateProductSetRequest"; - }; - - return UpdateProductSetRequest; - })(); - - v1p3beta1.DeleteProductSetRequest = (function() { - - /** - * Properties of a DeleteProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IDeleteProductSetRequest - * @property {string|null} [name] DeleteProductSetRequest name - */ - - /** - * Constructs a new DeleteProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a DeleteProductSetRequest. - * @implements IDeleteProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IDeleteProductSetRequest=} [properties] Properties to set - */ - function DeleteProductSetRequest(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]]; - } - - /** - * DeleteProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @instance - */ - DeleteProductSetRequest.prototype.name = ""; - - /** - * Creates a new DeleteProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.DeleteProductSetRequest} DeleteProductSetRequest instance - */ - DeleteProductSetRequest.create = function create(properties) { - return new DeleteProductSetRequest(properties); - }; - - /** - * Encodes the specified DeleteProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteProductSetRequest} message DeleteProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteProductSetRequest} message DeleteProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @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.DeleteProductSetRequest} DeleteProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductSetRequest.decode = function decode(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.DeleteProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.DeleteProductSetRequest} DeleteProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.DeleteProductSetRequest} DeleteProductSetRequest - */ - DeleteProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.DeleteProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.DeleteProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.DeleteProductSetRequest} message DeleteProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.DeleteProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.DeleteProductSetRequest"; - }; - - return DeleteProductSetRequest; - })(); - - v1p3beta1.CreateReferenceImageRequest = (function() { - - /** - * Properties of a CreateReferenceImageRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ICreateReferenceImageRequest - * @property {string|null} [parent] CreateReferenceImageRequest parent - * @property {google.cloud.vision.v1p3beta1.IReferenceImage|null} [referenceImage] CreateReferenceImageRequest referenceImage - * @property {string|null} [referenceImageId] CreateReferenceImageRequest referenceImageId - */ - - /** - * Constructs a new CreateReferenceImageRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CreateReferenceImageRequest. - * @implements ICreateReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest=} [properties] Properties to set - */ - function CreateReferenceImageRequest(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]]; - } - - /** - * CreateReferenceImageRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.parent = ""; - - /** - * CreateReferenceImageRequest referenceImage. - * @member {google.cloud.vision.v1p3beta1.IReferenceImage|null|undefined} referenceImage - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.referenceImage = null; - - /** - * CreateReferenceImageRequest referenceImageId. - * @member {string} referenceImageId - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.referenceImageId = ""; - - /** - * Creates a new CreateReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CreateReferenceImageRequest} CreateReferenceImageRequest instance - */ - CreateReferenceImageRequest.create = function create(properties) { - return new CreateReferenceImageRequest(properties); - }; - - /** - * Encodes the specified CreateReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest} message CreateReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.referenceImage != null && Object.hasOwnProperty.call(message, "referenceImage")) - $root.google.cloud.vision.v1p3beta1.ReferenceImage.encode(message.referenceImage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.referenceImageId != null && Object.hasOwnProperty.call(message, "referenceImageId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.referenceImageId); - return writer; - }; - - /** - * Encodes the specified CreateReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CreateReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest} message CreateReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @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.CreateReferenceImageRequest} CreateReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateReferenceImageRequest.decode = function decode(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.CreateReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.referenceImage = $root.google.cloud.vision.v1p3beta1.ReferenceImage.decode(reader, reader.uint32()); - break; - } - case 3: { - message.referenceImageId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.CreateReferenceImageRequest} CreateReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.referenceImage != null && message.hasOwnProperty("referenceImage")) { - var error = $root.google.cloud.vision.v1p3beta1.ReferenceImage.verify(message.referenceImage); - if (error) - return "referenceImage." + error; - } - if (message.referenceImageId != null && message.hasOwnProperty("referenceImageId")) - if (!$util.isString(message.referenceImageId)) - return "referenceImageId: string expected"; - return null; - }; - - /** - * Creates a CreateReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CreateReferenceImageRequest} CreateReferenceImageRequest - */ - CreateReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.referenceImage != null) { - if (typeof object.referenceImage !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.CreateReferenceImageRequest.referenceImage: object expected"); - message.referenceImage = $root.google.cloud.vision.v1p3beta1.ReferenceImage.fromObject(object.referenceImage); - } - if (object.referenceImageId != null) - message.referenceImageId = String(object.referenceImageId); - return message; - }; - - /** - * Creates a plain object from a CreateReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.CreateReferenceImageRequest} message CreateReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.referenceImage = null; - object.referenceImageId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.referenceImage != null && message.hasOwnProperty("referenceImage")) - object.referenceImage = $root.google.cloud.vision.v1p3beta1.ReferenceImage.toObject(message.referenceImage, options); - if (message.referenceImageId != null && message.hasOwnProperty("referenceImageId")) - object.referenceImageId = message.referenceImageId; - return object; - }; - - /** - * Converts this CreateReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - CreateReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.CreateReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.CreateReferenceImageRequest"; - }; - - return CreateReferenceImageRequest; - })(); - - v1p3beta1.ListReferenceImagesRequest = (function() { - - /** - * Properties of a ListReferenceImagesRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IListReferenceImagesRequest - * @property {string|null} [parent] ListReferenceImagesRequest parent - * @property {number|null} [pageSize] ListReferenceImagesRequest pageSize - * @property {string|null} [pageToken] ListReferenceImagesRequest pageToken - */ - - /** - * Constructs a new ListReferenceImagesRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ListReferenceImagesRequest. - * @implements IListReferenceImagesRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesRequest=} [properties] Properties to set - */ - function ListReferenceImagesRequest(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]]; - } - - /** - * ListReferenceImagesRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.parent = ""; - - /** - * ListReferenceImagesRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.pageSize = 0; - - /** - * ListReferenceImagesRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.pageToken = ""; - - /** - * Creates a new ListReferenceImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ListReferenceImagesRequest} ListReferenceImagesRequest instance - */ - ListReferenceImagesRequest.create = function create(properties) { - return new ListReferenceImagesRequest(properties); - }; - - /** - * Encodes the specified ListReferenceImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListReferenceImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesRequest} message ListReferenceImagesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListReferenceImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListReferenceImagesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesRequest} message ListReferenceImagesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @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.ListReferenceImagesRequest} ListReferenceImagesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesRequest.decode = function decode(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.ListReferenceImagesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ListReferenceImagesRequest} ListReferenceImagesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListReferenceImagesRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListReferenceImagesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListReferenceImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ListReferenceImagesRequest} ListReferenceImagesRequest - */ - ListReferenceImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListReferenceImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ListReferenceImagesRequest} message ListReferenceImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListReferenceImagesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListReferenceImagesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @instance - * @returns {Object.} JSON object - */ - ListReferenceImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListReferenceImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListReferenceImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ListReferenceImagesRequest"; - }; - - return ListReferenceImagesRequest; - })(); - - v1p3beta1.ListReferenceImagesResponse = (function() { - - /** - * Properties of a ListReferenceImagesResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IListReferenceImagesResponse - * @property {Array.|null} [referenceImages] ListReferenceImagesResponse referenceImages - * @property {number|null} [pageSize] ListReferenceImagesResponse pageSize - * @property {string|null} [nextPageToken] ListReferenceImagesResponse nextPageToken - */ - - /** - * Constructs a new ListReferenceImagesResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ListReferenceImagesResponse. - * @implements IListReferenceImagesResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesResponse=} [properties] Properties to set - */ - function ListReferenceImagesResponse(properties) { - this.referenceImages = []; - 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]]; - } - - /** - * ListReferenceImagesResponse referenceImages. - * @member {Array.} referenceImages - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.referenceImages = $util.emptyArray; - - /** - * ListReferenceImagesResponse pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.pageSize = 0; - - /** - * ListReferenceImagesResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListReferenceImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ListReferenceImagesResponse} ListReferenceImagesResponse instance - */ - ListReferenceImagesResponse.create = function create(properties) { - return new ListReferenceImagesResponse(properties); - }; - - /** - * Encodes the specified ListReferenceImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListReferenceImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesResponse} message ListReferenceImagesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.referenceImages != null && message.referenceImages.length) - for (var i = 0; i < message.referenceImages.length; ++i) - $root.google.cloud.vision.v1p3beta1.ReferenceImage.encode(message.referenceImages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListReferenceImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListReferenceImagesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListReferenceImagesResponse} message ListReferenceImagesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @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.ListReferenceImagesResponse} ListReferenceImagesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesResponse.decode = function decode(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.ListReferenceImagesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.referenceImages && message.referenceImages.length)) - message.referenceImages = []; - message.referenceImages.push($root.google.cloud.vision.v1p3beta1.ReferenceImage.decode(reader, reader.uint32())); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ListReferenceImagesResponse} ListReferenceImagesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListReferenceImagesResponse message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListReferenceImagesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.referenceImages != null && message.hasOwnProperty("referenceImages")) { - if (!Array.isArray(message.referenceImages)) - return "referenceImages: array expected"; - for (var i = 0; i < message.referenceImages.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.ReferenceImage.verify(message.referenceImages[i]); - if (error) - return "referenceImages." + error; - } - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListReferenceImagesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ListReferenceImagesResponse} ListReferenceImagesResponse - */ - ListReferenceImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ListReferenceImagesResponse) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ListReferenceImagesResponse(); - if (object.referenceImages) { - if (!Array.isArray(object.referenceImages)) - throw TypeError(".google.cloud.vision.v1p3beta1.ListReferenceImagesResponse.referenceImages: array expected"); - message.referenceImages = []; - for (var i = 0; i < object.referenceImages.length; ++i) { - if (typeof object.referenceImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ListReferenceImagesResponse.referenceImages: object expected"); - message.referenceImages[i] = $root.google.cloud.vision.v1p3beta1.ReferenceImage.fromObject(object.referenceImages[i]); - } - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListReferenceImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.ListReferenceImagesResponse} message ListReferenceImagesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListReferenceImagesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.referenceImages = []; - if (options.defaults) { - object.pageSize = 0; - object.nextPageToken = ""; - } - if (message.referenceImages && message.referenceImages.length) { - object.referenceImages = []; - for (var j = 0; j < message.referenceImages.length; ++j) - object.referenceImages[j] = $root.google.cloud.vision.v1p3beta1.ReferenceImage.toObject(message.referenceImages[j], options); - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListReferenceImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @instance - * @returns {Object.} JSON object - */ - ListReferenceImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListReferenceImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ListReferenceImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListReferenceImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ListReferenceImagesResponse"; - }; - - return ListReferenceImagesResponse; - })(); - - v1p3beta1.GetReferenceImageRequest = (function() { - - /** - * Properties of a GetReferenceImageRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IGetReferenceImageRequest - * @property {string|null} [name] GetReferenceImageRequest name - */ - - /** - * Constructs a new GetReferenceImageRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a GetReferenceImageRequest. - * @implements IGetReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IGetReferenceImageRequest=} [properties] Properties to set - */ - function GetReferenceImageRequest(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]]; - } - - /** - * GetReferenceImageRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @instance - */ - GetReferenceImageRequest.prototype.name = ""; - - /** - * Creates a new GetReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.GetReferenceImageRequest} GetReferenceImageRequest instance - */ - GetReferenceImageRequest.create = function create(properties) { - return new GetReferenceImageRequest(properties); - }; - - /** - * Encodes the specified GetReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetReferenceImageRequest} message GetReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GetReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IGetReferenceImageRequest} message GetReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @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.GetReferenceImageRequest} GetReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetReferenceImageRequest.decode = function decode(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.GetReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.GetReferenceImageRequest} GetReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.GetReferenceImageRequest} GetReferenceImageRequest - */ - GetReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.GetReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.GetReferenceImageRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.GetReferenceImageRequest} message GetReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - GetReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.GetReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.GetReferenceImageRequest"; - }; - - return GetReferenceImageRequest; - })(); - - v1p3beta1.DeleteReferenceImageRequest = (function() { - - /** - * Properties of a DeleteReferenceImageRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IDeleteReferenceImageRequest - * @property {string|null} [name] DeleteReferenceImageRequest name - */ - - /** - * Constructs a new DeleteReferenceImageRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a DeleteReferenceImageRequest. - * @implements IDeleteReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest=} [properties] Properties to set - */ - function DeleteReferenceImageRequest(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]]; - } - - /** - * DeleteReferenceImageRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @instance - */ - DeleteReferenceImageRequest.prototype.name = ""; - - /** - * Creates a new DeleteReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest} DeleteReferenceImageRequest instance - */ - DeleteReferenceImageRequest.create = function create(properties) { - return new DeleteReferenceImageRequest(properties); - }; - - /** - * Encodes the specified DeleteReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest} message DeleteReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest} message DeleteReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest} DeleteReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteReferenceImageRequest.decode = function decode(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.DeleteReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest} DeleteReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest} DeleteReferenceImageRequest - */ - DeleteReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest} message DeleteReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest"; - }; - - return DeleteReferenceImageRequest; - })(); - - v1p3beta1.AddProductToProductSetRequest = (function() { - - /** - * Properties of an AddProductToProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IAddProductToProductSetRequest - * @property {string|null} [name] AddProductToProductSetRequest name - * @property {string|null} [product] AddProductToProductSetRequest product - */ - - /** - * Constructs a new AddProductToProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AddProductToProductSetRequest. - * @implements IAddProductToProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest=} [properties] Properties to set - */ - function AddProductToProductSetRequest(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]]; - } - - /** - * AddProductToProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @instance - */ - AddProductToProductSetRequest.prototype.name = ""; - - /** - * AddProductToProductSetRequest product. - * @member {string} product - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @instance - */ - AddProductToProductSetRequest.prototype.product = ""; - - /** - * Creates a new AddProductToProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AddProductToProductSetRequest} AddProductToProductSetRequest instance - */ - AddProductToProductSetRequest.create = function create(properties) { - return new AddProductToProductSetRequest(properties); - }; - - /** - * Encodes the specified AddProductToProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AddProductToProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest} message AddProductToProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddProductToProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.product); - return writer; - }; - - /** - * Encodes the specified AddProductToProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AddProductToProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest} message AddProductToProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddProductToProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @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.AddProductToProductSetRequest} AddProductToProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AddProductToProductSetRequest.decode = function decode(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.AddProductToProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.product = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.AddProductToProductSetRequest} AddProductToProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AddProductToProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AddProductToProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AddProductToProductSetRequest.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.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - return null; - }; - - /** - * Creates an AddProductToProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AddProductToProductSetRequest} AddProductToProductSetRequest - */ - AddProductToProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.product != null) - message.product = String(object.product); - return message; - }; - - /** - * Creates a plain object from an AddProductToProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.AddProductToProductSetRequest} message AddProductToProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AddProductToProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.product = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - return object; - }; - - /** - * Converts this AddProductToProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - AddProductToProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AddProductToProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.AddProductToProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AddProductToProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.AddProductToProductSetRequest"; - }; - - return AddProductToProductSetRequest; - })(); - - v1p3beta1.RemoveProductFromProductSetRequest = (function() { - - /** - * Properties of a RemoveProductFromProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IRemoveProductFromProductSetRequest - * @property {string|null} [name] RemoveProductFromProductSetRequest name - * @property {string|null} [product] RemoveProductFromProductSetRequest product - */ - - /** - * Constructs a new RemoveProductFromProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a RemoveProductFromProductSetRequest. - * @implements IRemoveProductFromProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest=} [properties] Properties to set - */ - function RemoveProductFromProductSetRequest(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]]; - } - - /** - * RemoveProductFromProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @instance - */ - RemoveProductFromProductSetRequest.prototype.name = ""; - - /** - * RemoveProductFromProductSetRequest product. - * @member {string} product - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @instance - */ - RemoveProductFromProductSetRequest.prototype.product = ""; - - /** - * Creates a new RemoveProductFromProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest instance - */ - RemoveProductFromProductSetRequest.create = function create(properties) { - return new RemoveProductFromProductSetRequest(properties); - }; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RemoveProductFromProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.product); - return writer; - }; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RemoveProductFromProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RemoveProductFromProductSetRequest.decode = function decode(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.RemoveProductFromProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.product = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RemoveProductFromProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RemoveProductFromProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RemoveProductFromProductSetRequest.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.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - return null; - }; - - /** - * Creates a RemoveProductFromProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - */ - RemoveProductFromProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.product != null) - message.product = String(object.product); - return message; - }; - - /** - * Creates a plain object from a RemoveProductFromProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RemoveProductFromProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.product = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - return object; - }; - - /** - * Converts this RemoveProductFromProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - RemoveProductFromProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RemoveProductFromProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RemoveProductFromProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest"; - }; - - return RemoveProductFromProductSetRequest; - })(); - - v1p3beta1.ListProductsInProductSetRequest = (function() { - - /** - * Properties of a ListProductsInProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IListProductsInProductSetRequest - * @property {string|null} [name] ListProductsInProductSetRequest name - * @property {number|null} [pageSize] ListProductsInProductSetRequest pageSize - * @property {string|null} [pageToken] ListProductsInProductSetRequest pageToken - */ - - /** - * Constructs a new ListProductsInProductSetRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ListProductsInProductSetRequest. - * @implements IListProductsInProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest=} [properties] Properties to set - */ - function ListProductsInProductSetRequest(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]]; - } - - /** - * ListProductsInProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.name = ""; - - /** - * ListProductsInProductSetRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.pageSize = 0; - - /** - * ListProductsInProductSetRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductsInProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest} ListProductsInProductSetRequest instance - */ - ListProductsInProductSetRequest.create = function create(properties) { - return new ListProductsInProductSetRequest(properties); - }; - - /** - * Encodes the specified ListProductsInProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest} message ListProductsInProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsInProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest} message ListProductsInProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest} ListProductsInProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetRequest.decode = function decode(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.ListProductsInProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest} ListProductsInProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsInProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsInProductSetRequest.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.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsInProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest} ListProductsInProductSetRequest - */ - ListProductsInProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsInProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest} message ListProductsInProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsInProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductsInProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductsInProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsInProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsInProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest"; - }; - - return ListProductsInProductSetRequest; - })(); - - v1p3beta1.ListProductsInProductSetResponse = (function() { - - /** - * Properties of a ListProductsInProductSetResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IListProductsInProductSetResponse - * @property {Array.|null} [products] ListProductsInProductSetResponse products - * @property {string|null} [nextPageToken] ListProductsInProductSetResponse nextPageToken - */ - - /** - * Constructs a new ListProductsInProductSetResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ListProductsInProductSetResponse. - * @implements IListProductsInProductSetResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse=} [properties] Properties to set - */ - function ListProductsInProductSetResponse(properties) { - this.products = []; - 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]]; - } - - /** - * ListProductsInProductSetResponse products. - * @member {Array.} products - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @instance - */ - ListProductsInProductSetResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsInProductSetResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @instance - */ - ListProductsInProductSetResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductsInProductSetResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse} ListProductsInProductSetResponse instance - */ - ListProductsInProductSetResponse.create = function create(properties) { - return new ListProductsInProductSetResponse(properties); - }; - - /** - * Encodes the specified ListProductsInProductSetResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse} message ListProductsInProductSetResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.vision.v1p3beta1.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsInProductSetResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse} message ListProductsInProductSetResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse} ListProductsInProductSetResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetResponse.decode = function decode(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.ListProductsInProductSetResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.vision.v1p3beta1.Product.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse} ListProductsInProductSetResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsInProductSetResponse message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsInProductSetResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsInProductSetResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse} ListProductsInProductSetResponse - */ - ListProductsInProductSetResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse.products: object expected"); - message.products[i] = $root.google.cloud.vision.v1p3beta1.Product.fromObject(object.products[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsInProductSetResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse} message ListProductsInProductSetResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsInProductSetResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.vision.v1p3beta1.Product.toObject(message.products[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductsInProductSetResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductsInProductSetResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsInProductSetResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsInProductSetResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse"; - }; - - return ListProductsInProductSetResponse; - })(); - - v1p3beta1.ImportProductSetsGcsSource = (function() { - - /** - * Properties of an ImportProductSetsGcsSource. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IImportProductSetsGcsSource - * @property {string|null} [csvFileUri] ImportProductSetsGcsSource csvFileUri - */ - - /** - * Constructs a new ImportProductSetsGcsSource. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImportProductSetsGcsSource. - * @implements IImportProductSetsGcsSource - * @constructor - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource=} [properties] Properties to set - */ - function ImportProductSetsGcsSource(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]]; - } - - /** - * ImportProductSetsGcsSource csvFileUri. - * @member {string} csvFileUri - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @instance - */ - ImportProductSetsGcsSource.prototype.csvFileUri = ""; - - /** - * Creates a new ImportProductSetsGcsSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource} ImportProductSetsGcsSource instance - */ - ImportProductSetsGcsSource.create = function create(properties) { - return new ImportProductSetsGcsSource(properties); - }; - - /** - * Encodes the specified ImportProductSetsGcsSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource} message ImportProductSetsGcsSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsGcsSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.csvFileUri != null && Object.hasOwnProperty.call(message, "csvFileUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.csvFileUri); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsGcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource} message ImportProductSetsGcsSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsGcsSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource} ImportProductSetsGcsSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsGcsSource.decode = function decode(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.ImportProductSetsGcsSource(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.csvFileUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource} ImportProductSetsGcsSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsGcsSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsGcsSource message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsGcsSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.csvFileUri != null && message.hasOwnProperty("csvFileUri")) - if (!$util.isString(message.csvFileUri)) - return "csvFileUri: string expected"; - return null; - }; - - /** - * Creates an ImportProductSetsGcsSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource} ImportProductSetsGcsSource - */ - ImportProductSetsGcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource(); - if (object.csvFileUri != null) - message.csvFileUri = String(object.csvFileUri); - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsGcsSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource} message ImportProductSetsGcsSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsGcsSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.csvFileUri = ""; - if (message.csvFileUri != null && message.hasOwnProperty("csvFileUri")) - object.csvFileUri = message.csvFileUri; - return object; - }; - - /** - * Converts this ImportProductSetsGcsSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsGcsSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsGcsSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsGcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource"; - }; - - return ImportProductSetsGcsSource; - })(); - - v1p3beta1.ImportProductSetsInputConfig = (function() { - - /** - * Properties of an ImportProductSetsInputConfig. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IImportProductSetsInputConfig - * @property {google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource|null} [gcsSource] ImportProductSetsInputConfig gcsSource - */ - - /** - * Constructs a new ImportProductSetsInputConfig. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImportProductSetsInputConfig. - * @implements IImportProductSetsInputConfig - * @constructor - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig=} [properties] Properties to set - */ - function ImportProductSetsInputConfig(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]]; - } - - /** - * ImportProductSetsInputConfig gcsSource. - * @member {google.cloud.vision.v1p3beta1.IImportProductSetsGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @instance - */ - ImportProductSetsInputConfig.prototype.gcsSource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ImportProductSetsInputConfig source. - * @member {"gcsSource"|undefined} source - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @instance - */ - Object.defineProperty(ImportProductSetsInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ImportProductSetsInputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig} ImportProductSetsInputConfig instance - */ - ImportProductSetsInputConfig.create = function create(properties) { - return new ImportProductSetsInputConfig(properties); - }; - - /** - * Encodes the specified ImportProductSetsInputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig} message ImportProductSetsInputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsInputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsInputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig} message ImportProductSetsInputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsInputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig} ImportProductSetsInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsInputConfig.decode = function decode(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.ImportProductSetsInputConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsSource = $root.google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig} ImportProductSetsInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsInputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsInputConfig message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsInputConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - properties.source = 1; - { - var error = $root.google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - } - return null; - }; - - /** - * Creates an ImportProductSetsInputConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig} ImportProductSetsInputConfig - */ - ImportProductSetsInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.fromObject(object.gcsSource); - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsInputConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig} message ImportProductSetsInputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsInputConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - return object; - }; - - /** - * Converts this ImportProductSetsInputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsInputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsInputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig"; - }; - - return ImportProductSetsInputConfig; - })(); - - v1p3beta1.ImportProductSetsRequest = (function() { - - /** - * Properties of an ImportProductSetsRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IImportProductSetsRequest - * @property {string|null} [parent] ImportProductSetsRequest parent - * @property {google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig|null} [inputConfig] ImportProductSetsRequest inputConfig - */ - - /** - * Constructs a new ImportProductSetsRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImportProductSetsRequest. - * @implements IImportProductSetsRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsRequest=} [properties] Properties to set - */ - function ImportProductSetsRequest(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]]; - } - - /** - * ImportProductSetsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @instance - */ - ImportProductSetsRequest.prototype.parent = ""; - - /** - * ImportProductSetsRequest inputConfig. - * @member {google.cloud.vision.v1p3beta1.IImportProductSetsInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @instance - */ - ImportProductSetsRequest.prototype.inputConfig = null; - - /** - * Creates a new ImportProductSetsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsRequest} ImportProductSetsRequest instance - */ - ImportProductSetsRequest.create = function create(properties) { - return new ImportProductSetsRequest(properties); - }; - - /** - * Encodes the specified ImportProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsRequest} message ImportProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsRequest} message ImportProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @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.ImportProductSetsRequest} ImportProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsRequest.decode = function decode(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.ImportProductSetsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.inputConfig = $root.google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsRequest} ImportProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsRequest message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - return null; - }; - - /** - * Creates an ImportProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsRequest} ImportProductSetsRequest - */ - ImportProductSetsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImportProductSetsRequest) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ImportProductSetsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImportProductSetsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig.fromObject(object.inputConfig); - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1p3beta1.ImportProductSetsRequest} message ImportProductSetsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = 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.v1p3beta1.ImportProductSetsInputConfig.toObject(message.inputConfig, options); - return object; - }; - - /** - * Converts this ImportProductSetsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ImportProductSetsRequest"; - }; - - return ImportProductSetsRequest; - })(); - - v1p3beta1.ImportProductSetsResponse = (function() { - - /** - * Properties of an ImportProductSetsResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IImportProductSetsResponse - * @property {Array.|null} [referenceImages] ImportProductSetsResponse referenceImages - * @property {Array.|null} [statuses] ImportProductSetsResponse statuses - */ - - /** - * Constructs a new ImportProductSetsResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImportProductSetsResponse. - * @implements IImportProductSetsResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsResponse=} [properties] Properties to set - */ - function ImportProductSetsResponse(properties) { - this.referenceImages = []; - this.statuses = []; - 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]]; - } - - /** - * ImportProductSetsResponse referenceImages. - * @member {Array.} referenceImages - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @instance - */ - ImportProductSetsResponse.prototype.referenceImages = $util.emptyArray; - - /** - * ImportProductSetsResponse statuses. - * @member {Array.} statuses - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @instance - */ - ImportProductSetsResponse.prototype.statuses = $util.emptyArray; - - /** - * Creates a new ImportProductSetsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsResponse} ImportProductSetsResponse instance - */ - ImportProductSetsResponse.create = function create(properties) { - return new ImportProductSetsResponse(properties); - }; - - /** - * Encodes the specified ImportProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsResponse} message ImportProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.referenceImages != null && message.referenceImages.length) - for (var i = 0; i < message.referenceImages.length; ++i) - $root.google.cloud.vision.v1p3beta1.ReferenceImage.encode(message.referenceImages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.statuses != null && message.statuses.length) - for (var i = 0; i < message.statuses.length; ++i) - $root.google.rpc.Status.encode(message.statuses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImportProductSetsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IImportProductSetsResponse} message ImportProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @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.ImportProductSetsResponse} ImportProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsResponse.decode = function decode(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.ImportProductSetsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.referenceImages && message.referenceImages.length)) - message.referenceImages = []; - message.referenceImages.push($root.google.cloud.vision.v1p3beta1.ReferenceImage.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.statuses && message.statuses.length)) - message.statuses = []; - message.statuses.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsResponse} ImportProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsResponse message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.referenceImages != null && message.hasOwnProperty("referenceImages")) { - if (!Array.isArray(message.referenceImages)) - return "referenceImages: array expected"; - for (var i = 0; i < message.referenceImages.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.ReferenceImage.verify(message.referenceImages[i]); - if (error) - return "referenceImages." + error; - } - } - if (message.statuses != null && message.hasOwnProperty("statuses")) { - if (!Array.isArray(message.statuses)) - return "statuses: array expected"; - for (var i = 0; i < message.statuses.length; ++i) { - var error = $root.google.rpc.Status.verify(message.statuses[i]); - if (error) - return "statuses." + error; - } - } - return null; - }; - - /** - * Creates an ImportProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImportProductSetsResponse} ImportProductSetsResponse - */ - ImportProductSetsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImportProductSetsResponse) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.ImportProductSetsResponse(); - if (object.referenceImages) { - if (!Array.isArray(object.referenceImages)) - throw TypeError(".google.cloud.vision.v1p3beta1.ImportProductSetsResponse.referenceImages: array expected"); - message.referenceImages = []; - for (var i = 0; i < object.referenceImages.length; ++i) { - if (typeof object.referenceImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImportProductSetsResponse.referenceImages: object expected"); - message.referenceImages[i] = $root.google.cloud.vision.v1p3beta1.ReferenceImage.fromObject(object.referenceImages[i]); - } - } - if (object.statuses) { - if (!Array.isArray(object.statuses)) - throw TypeError(".google.cloud.vision.v1p3beta1.ImportProductSetsResponse.statuses: array expected"); - message.statuses = []; - for (var i = 0; i < object.statuses.length; ++i) { - if (typeof object.statuses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImportProductSetsResponse.statuses: object expected"); - message.statuses[i] = $root.google.rpc.Status.fromObject(object.statuses[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1p3beta1.ImportProductSetsResponse} message ImportProductSetsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.referenceImages = []; - object.statuses = []; - } - if (message.referenceImages && message.referenceImages.length) { - object.referenceImages = []; - for (var j = 0; j < message.referenceImages.length; ++j) - object.referenceImages[j] = $root.google.cloud.vision.v1p3beta1.ReferenceImage.toObject(message.referenceImages[j], options); - } - if (message.statuses && message.statuses.length) { - object.statuses = []; - for (var j = 0; j < message.statuses.length; ++j) - object.statuses[j] = $root.google.rpc.Status.toObject(message.statuses[j], options); - } - return object; - }; - - /** - * Converts this ImportProductSetsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.ImportProductSetsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.ImportProductSetsResponse"; - }; - - return ImportProductSetsResponse; - })(); - - v1p3beta1.BatchOperationMetadata = (function() { - - /** - * Properties of a BatchOperationMetadata. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IBatchOperationMetadata - * @property {google.cloud.vision.v1p3beta1.BatchOperationMetadata.State|null} [state] BatchOperationMetadata state - * @property {google.protobuf.ITimestamp|null} [submitTime] BatchOperationMetadata submitTime - * @property {google.protobuf.ITimestamp|null} [endTime] BatchOperationMetadata endTime - */ - - /** - * Constructs a new BatchOperationMetadata. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a BatchOperationMetadata. - * @implements IBatchOperationMetadata - * @constructor - * @param {google.cloud.vision.v1p3beta1.IBatchOperationMetadata=} [properties] Properties to set - */ - function BatchOperationMetadata(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]]; - } - - /** - * BatchOperationMetadata state. - * @member {google.cloud.vision.v1p3beta1.BatchOperationMetadata.State} state - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.state = 0; - - /** - * BatchOperationMetadata submitTime. - * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.submitTime = null; - - /** - * BatchOperationMetadata endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.endTime = null; - - /** - * Creates a new BatchOperationMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1p3beta1.IBatchOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.BatchOperationMetadata} BatchOperationMetadata instance - */ - BatchOperationMetadata.create = function create(properties) { - return new BatchOperationMetadata(properties); - }; - - /** - * Encodes the specified BatchOperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchOperationMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1p3beta1.IBatchOperationMetadata} message BatchOperationMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchOperationMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BatchOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchOperationMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1p3beta1.IBatchOperationMetadata} message BatchOperationMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @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.BatchOperationMetadata} BatchOperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchOperationMetadata.decode = function decode(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.BatchOperationMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.state = reader.int32(); - break; - } - case 2: { - message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.BatchOperationMetadata} BatchOperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchOperationMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchOperationMetadata message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BatchOperationMetadata.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.submitTime != null && message.hasOwnProperty("submitTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.submitTime); - if (error) - return "submitTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - return null; - }; - - /** - * Creates a BatchOperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.BatchOperationMetadata} BatchOperationMetadata - */ - BatchOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.BatchOperationMetadata) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.BatchOperationMetadata(); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "PROCESSING": - case 1: - message.state = 1; - break; - case "SUCCESSFUL": - case 2: - message.state = 2; - break; - case "FAILED": - case 3: - message.state = 3; - break; - case "CANCELLED": - case 4: - message.state = 4; - break; - } - if (object.submitTime != null) { - if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.BatchOperationMetadata.submitTime: object expected"); - message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.BatchOperationMetadata.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - return message; - }; - - /** - * Creates a plain object from a BatchOperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1p3beta1.BatchOperationMetadata} message BatchOperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchOperationMetadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.submitTime = null; - object.endTime = null; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.vision.v1p3beta1.BatchOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.vision.v1p3beta1.BatchOperationMetadata.State[message.state] : message.state; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) - object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - return object; - }; - - /** - * Converts this BatchOperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @instance - * @returns {Object.} JSON object - */ - BatchOperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchOperationMetadata - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.BatchOperationMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.BatchOperationMetadata"; - }; - - /** - * State enum. - * @name google.cloud.vision.v1p3beta1.BatchOperationMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} PROCESSING=1 PROCESSING value - * @property {number} SUCCESSFUL=2 SUCCESSFUL value - * @property {number} FAILED=3 FAILED value - * @property {number} CANCELLED=4 CANCELLED value - */ - BatchOperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PROCESSING"] = 1; - values[valuesById[2] = "SUCCESSFUL"] = 2; - values[valuesById[3] = "FAILED"] = 3; - values[valuesById[4] = "CANCELLED"] = 4; - return values; - })(); - - return BatchOperationMetadata; - })(); - - v1p3beta1.TextAnnotation = (function() { - - /** - * Properties of a TextAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ITextAnnotation - * @property {Array.|null} [pages] TextAnnotation pages - * @property {string|null} [text] TextAnnotation text - */ - - /** - * Constructs a new TextAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a TextAnnotation. - * @implements ITextAnnotation - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.pages = $util.emptyArray; - - /** - * TextAnnotation text. - * @member {string} text - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.text = ""; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ITextAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.TextAnnotation} TextAnnotation instance - */ - TextAnnotation.create = function create(properties) { - return new TextAnnotation(properties); - }; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.TextAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.TextAnnotation} TextAnnotation - */ - TextAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.TextAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.TextAnnotation(); - if (object.pages) { - if (!Array.isArray(object.pages)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.pages: object expected"); - message.pages[i] = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation - * @instance - * @returns {Object.} JSON object - */ - TextAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.TextAnnotation"; - }; - - TextAnnotation.DetectedLanguage = (function() { - - /** - * Properties of a DetectedLanguage. - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @interface IDetectedLanguage - * @property {string|null} [languageCode] DetectedLanguage languageCode - * @property {number|null} [confidence] DetectedLanguage confidence - */ - - /** - * Constructs a new DetectedLanguage. - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @classdesc Represents a DetectedLanguage. - * @implements IDetectedLanguage - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.languageCode = ""; - - /** - * DetectedLanguage confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.confidence = 0; - - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p3beta1.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 && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p3beta1.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(); - }; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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; - }; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.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()); - }; - - /** - * Verifies a DetectedLanguage message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.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; - }; - - /** - * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage} DetectedLanguage - */ - DetectedLanguage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage(); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p3beta1.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; - return object; - }; - - /** - * Converts this DetectedLanguage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @instance - * @returns {Object.} JSON object - */ - DetectedLanguage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DetectedLanguage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage"; - }; - - return DetectedLanguage; - })(); - - TextAnnotation.DetectedBreak = (function() { - - /** - * Properties of a DetectedBreak. - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @interface IDetectedBreak - * @property {google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.BreakType|null} [type] DetectedBreak type - * @property {boolean|null} [isPrefix] DetectedBreak isPrefix - */ - - /** - * Constructs a new DetectedBreak. - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @classdesc Represents a DetectedBreak. - * @implements IDetectedBreak - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * DetectedBreak type. - * @member {google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.BreakType} type - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.type = 0; - - /** - * DetectedBreak isPrefix. - * @member {boolean} isPrefix - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.isPrefix = false; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak} DetectedBreak instance - */ - DetectedBreak.create = function create(properties) { - return new DetectedBreak(properties); - }; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p3beta1.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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.isPrefix != null && Object.hasOwnProperty.call(message, "isPrefix")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isPrefix); - return writer; - }; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p3beta1.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(); - }; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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; - }; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedBreak - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak} DetectedBreak - */ - DetectedBreak.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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.v1p3beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedBreak.BreakType[message.type] === undefined ? message.type : $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedBreak - * @instance - * @returns {Object.} JSON object - */ - DetectedBreak.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DetectedBreak - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak"; - }; - - /** - * BreakType enum. - * @name google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.BreakType - * @enum {number} - * @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.v1p3beta1.TextAnnotation - * @interface ITextProperty - * @property {Array.|null} [detectedLanguages] TextProperty detectedLanguages - * @property {google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak|null} [detectedBreak] TextProperty detectedBreak - */ - - /** - * Constructs a new TextProperty. - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation - * @classdesc Represents a TextProperty. - * @implements ITextProperty - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedLanguages = $util.emptyArray; - - /** - * TextProperty detectedBreak. - * @member {google.cloud.vision.v1p3beta1.TextAnnotation.IDetectedBreak|null|undefined} detectedBreak - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedBreak = null; - - /** - * Creates a new TextProperty instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.detectedBreak != null && Object.hasOwnProperty.call(message, "detectedBreak")) - $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedLanguage.decode(reader, reader.uint32())); - break; - } - case 2: { - message.detectedBreak = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedLanguage.verify(message.detectedLanguages[i]); - if (error) - return "detectedLanguages." + error; - } - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { - var error = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty} TextProperty - */ - TextProperty.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty(); - if (object.detectedLanguages) { - if (!Array.isArray(object.detectedLanguages)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.detectedLanguages: object expected"); - message.detectedLanguages[i] = $root.google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage.fromObject(object.detectedLanguages[i]); - } - } - if (object.detectedBreak != null) { - if (typeof object.detectedBreak !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.detectedBreak: object expected"); - message.detectedBreak = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.DetectedLanguage.toObject(message.detectedLanguages[j], options); - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) - object.detectedBreak = $root.google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak.toObject(message.detectedBreak, options); - return object; - }; - - /** - * Converts this TextProperty to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty - * @instance - * @returns {Object.} JSON object - */ - TextProperty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextProperty - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextProperty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty"; - }; - - return TextProperty; - })(); - - return TextAnnotation; - })(); - - v1p3beta1.Page = (function() { - - /** - * Properties of a Page. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IPage - * @property {google.cloud.vision.v1p3beta1.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.v1p3beta1 - * @classdesc Represents a Page. - * @implements IPage - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p3beta1.Page - * @instance - */ - Page.prototype.property = null; - - /** - * Page width. - * @member {number} width - * @memberof google.cloud.vision.v1p3beta1.Page - * @instance - */ - Page.prototype.width = 0; - - /** - * Page height. - * @member {number} height - * @memberof google.cloud.vision.v1p3beta1.Page - * @instance - */ - Page.prototype.height = 0; - - /** - * Page blocks. - * @member {Array.} blocks - * @memberof google.cloud.vision.v1p3beta1.Page - * @instance - */ - Page.prototype.blocks = $util.emptyArray; - - /** - * Page confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.Page - * @instance - */ - Page.prototype.confidence = 0; - - /** - * Creates a new Page instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Page - * @static - * @param {google.cloud.vision.v1p3beta1.IPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Page} Page instance - */ - Page.create = function create(properties) { - return new Page(properties); - }; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Page.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Page - * @static - * @param {google.cloud.vision.v1p3beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.width); - if (message.height != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.Block.encode(message.blocks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.Page.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Page - * @static - * @param {google.cloud.vision.v1p3beta1.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(); - }; - - /** - * Decodes a Page message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.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.v1p3beta1.Page} Page - * @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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.Page(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Block.decode(reader, reader.uint32())); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Page - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Page} Page - * @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) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Page message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.Page - * @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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + 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.v1p3beta1.Block.verify(message.blocks[i]); - if (error) - return "blocks." + 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. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Page - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Page} Page - */ - Page.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Page) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.Page(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Page.property: object expected"); - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - 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.v1p3beta1.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.v1p3beta1.Page.blocks: object expected"); - message.blocks[i] = $root.google.cloud.vision.v1p3beta1.Block.fromObject(object.blocks[i]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Page - * @static - * @param {google.cloud.vision.v1p3beta1.Page} message Page - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.width = 0; - object.height = 0; - object.confidence = 0; - } - if (message.property != null && message.hasOwnProperty("property")) - object.property = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.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 Page to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Page - * @instance - * @returns {Object.} JSON object - */ - Page.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Page - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Page - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Page"; - }; - - return Page; - })(); - - v1p3beta1.Block = (function() { - - /** - * Properties of a Block. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IBlock - * @property {google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null} [property] Block property - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingBox] Block boundingBox - * @property {Array.|null} [paragraphs] Block paragraphs - * @property {google.cloud.vision.v1p3beta1.Block.BlockType|null} [blockType] Block blockType - * @property {number|null} [confidence] Block confidence - */ - - /** - * Constructs a new Block. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Block. - * @implements IBlock - * @constructor - * @param {google.cloud.vision.v1p3beta1.IBlock=} [properties] Properties to set - */ - function Block(properties) { - this.paragraphs = []; - 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]]; - } - - /** - * Block property. - * @member {google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p3beta1.Block - * @instance - */ - Block.prototype.property = null; - - /** - * Block boundingBox. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p3beta1.Block - * @instance - */ - Block.prototype.boundingBox = null; - - /** - * Block paragraphs. - * @member {Array.} paragraphs - * @memberof google.cloud.vision.v1p3beta1.Block - * @instance - */ - Block.prototype.paragraphs = $util.emptyArray; - - /** - * Block blockType. - * @member {google.cloud.vision.v1p3beta1.Block.BlockType} blockType - * @memberof google.cloud.vision.v1p3beta1.Block - * @instance - */ - Block.prototype.blockType = 0; - - /** - * Block confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.Block - * @instance - */ - Block.prototype.confidence = 0; - - /** - * Creates a new Block instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Block - * @static - * @param {google.cloud.vision.v1p3beta1.IBlock=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Block} Block instance - */ - Block.create = function create(properties) { - return new Block(properties); - }; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Block.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Block - * @static - * @param {google.cloud.vision.v1p3beta1.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.property != null && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.blockType != null && Object.hasOwnProperty.call(message, "blockType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.blockType); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Block.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Block - * @static - * @param {google.cloud.vision.v1p3beta1.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Block message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.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.v1p3beta1.Block} Block - * @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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.Block(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.vision.v1p3beta1.Paragraph.decode(reader, reader.uint32())); - break; - } - case 4: { - message.blockType = reader.int32(); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Block - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Block} Block - * @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) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Block message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.Block - * @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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Paragraph.verify(message.paragraphs[i]); - if (error) - return "paragraphs." + 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 Block message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Block - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Block} Block - */ - Block.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Block) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.Block(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Block.property: object expected"); - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Block.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.paragraphs) { - if (!Array.isArray(object.paragraphs)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.Block.paragraphs: object expected"); - message.paragraphs[i] = $root.google.cloud.vision.v1p3beta1.Paragraph.fromObject(object.paragraphs[i]); - } - } - switch (object.blockType) { - default: - if (typeof object.blockType === "number") { - message.blockType = object.blockType; - break; - } - break; - 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 Block message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Block - * @static - * @param {google.cloud.vision.v1p3beta1.Block} message Block - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Block.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.v1p3beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Paragraph.toObject(message.paragraphs[j], options); - } - if (message.blockType != null && message.hasOwnProperty("blockType")) - object.blockType = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Block.BlockType[message.blockType] === undefined ? message.blockType : $root.google.cloud.vision.v1p3beta1.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 Block to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Block - * @instance - * @returns {Object.} JSON object - */ - Block.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Block - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Block - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Block"; - }; - - /** - * BlockType enum. - * @name google.cloud.vision.v1p3beta1.Block.BlockType - * @enum {number} - * @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; - })(); - - return Block; - })(); - - v1p3beta1.Paragraph = (function() { - - /** - * Properties of a Paragraph. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IParagraph - * @property {google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null} [property] Paragraph property - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingBox] Paragraph boundingBox - * @property {Array.|null} [words] Paragraph words - * @property {number|null} [confidence] Paragraph confidence - */ - - /** - * Constructs a new Paragraph. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Paragraph. - * @implements IParagraph - * @constructor - * @param {google.cloud.vision.v1p3beta1.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]]; - } - - /** - * Paragraph property. - * @member {google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p3beta1.Paragraph - * @instance - */ - Paragraph.prototype.property = null; - - /** - * Paragraph boundingBox. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p3beta1.Paragraph - * @instance - */ - Paragraph.prototype.boundingBox = null; - - /** - * Paragraph words. - * @member {Array.} words - * @memberof google.cloud.vision.v1p3beta1.Paragraph - * @instance - */ - Paragraph.prototype.words = $util.emptyArray; - - /** - * Paragraph confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.Paragraph - * @instance - */ - Paragraph.prototype.confidence = 0; - - /** - * Creates a new Paragraph instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p3beta1.IParagraph=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Paragraph} Paragraph instance - */ - Paragraph.create = function create(properties) { - return new Paragraph(properties); - }; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Paragraph.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p3beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Word.encode(message.words[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.Paragraph.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.Paragraph(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.words && message.words.length)) - message.words = []; - message.words.push($root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Paragraph - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.Paragraph - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Paragraph} Paragraph - */ - Paragraph.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Paragraph) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.Paragraph(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Paragraph.property: object expected"); - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Paragraph.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.words) { - if (!Array.isArray(object.words)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.Paragraph.words: object expected"); - message.words[i] = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.Paragraph - * @instance - * @returns {Object.} JSON object - */ - Paragraph.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Paragraph - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Paragraph - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Paragraph"; - }; - - return Paragraph; - })(); - - v1p3beta1.Word = (function() { - - /** - * Properties of a Word. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IWord - * @property {google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null} [property] Word property - * @property {google.cloud.vision.v1p3beta1.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.v1p3beta1 - * @classdesc Represents a Word. - * @implements IWord - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p3beta1.Word - * @instance - */ - Word.prototype.property = null; - - /** - * Word boundingBox. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p3beta1.Word - * @instance - */ - Word.prototype.boundingBox = null; - - /** - * Word symbols. - * @member {Array.} symbols - * @memberof google.cloud.vision.v1p3beta1.Word - * @instance - */ - Word.prototype.symbols = $util.emptyArray; - - /** - * Word confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.Word - * @instance - */ - Word.prototype.confidence = 0; - - /** - * Creates a new Word instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Word - * @static - * @param {google.cloud.vision.v1p3beta1.IWord=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Word} Word instance - */ - Word.create = function create(properties) { - return new Word(properties); - }; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Word.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Word - * @static - * @param {google.cloud.vision.v1p3beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Symbol.encode(message.symbols[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.Word.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Word - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.Word(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.symbols && message.symbols.length)) - message.symbols = []; - message.symbols.push($root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Word - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.Word - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Word} Word - */ - Word.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Word) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.Word(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Word.property: object expected"); - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Word.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.symbols) { - if (!Array.isArray(object.symbols)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.Word.symbols: object expected"); - message.symbols[i] = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Word - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.Word - * @instance - * @returns {Object.} JSON object - */ - Word.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Word - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Word - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Word.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Word"; - }; - - return Word; - })(); - - v1p3beta1.Symbol = (function() { - - /** - * Properties of a Symbol. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ISymbol - * @property {google.cloud.vision.v1p3beta1.TextAnnotation.ITextProperty|null} [property] Symbol property - * @property {google.cloud.vision.v1p3beta1.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.v1p3beta1 - * @classdesc Represents a Symbol. - * @implements ISymbol - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p3beta1.Symbol - * @instance - */ - Symbol.prototype.property = null; - - /** - * Symbol boundingBox. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p3beta1.Symbol - * @instance - */ - Symbol.prototype.boundingBox = null; - - /** - * Symbol text. - * @member {string} text - * @memberof google.cloud.vision.v1p3beta1.Symbol - * @instance - */ - Symbol.prototype.text = ""; - - /** - * Symbol confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.Symbol - * @instance - */ - Symbol.prototype.confidence = 0; - - /** - * Creates a new Symbol instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.Symbol - * @static - * @param {google.cloud.vision.v1p3beta1.ISymbol=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Symbol} Symbol instance - */ - Symbol.create = function create(properties) { - return new Symbol(properties); - }; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Symbol.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.Symbol - * @static - * @param {google.cloud.vision.v1p3beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "text")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.text); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p3beta1.Symbol.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Symbol - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.Symbol(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Symbol - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Symbol - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Symbol} Symbol - */ - Symbol.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Symbol) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.Symbol(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Symbol.property: object expected"); - message.property = $root.google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Symbol.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Symbol - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.Symbol - * @instance - * @returns {Object.} JSON object - */ - Symbol.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Symbol - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.Symbol - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Symbol.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.Symbol"; - }; - - return Symbol; - })(); - - v1p3beta1.WebDetection = (function() { - - /** - * Properties of a WebDetection. - * @memberof google.cloud.vision.v1p3beta1 - * @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.v1p3beta1 - * @classdesc Represents a WebDetection. - * @implements IWebDetection - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection - * @instance - */ - WebDetection.prototype.webEntities = $util.emptyArray; - - /** - * WebDetection fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @instance - */ - WebDetection.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebDetection partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @instance - */ - WebDetection.prototype.partialMatchingImages = $util.emptyArray; - - /** - * WebDetection pagesWithMatchingImages. - * @member {Array.} pagesWithMatchingImages - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @instance - */ - WebDetection.prototype.pagesWithMatchingImages = $util.emptyArray; - - /** - * WebDetection visuallySimilarImages. - * @member {Array.} visuallySimilarImages - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @instance - */ - WebDetection.prototype.visuallySimilarImages = $util.emptyArray; - - /** - * WebDetection bestGuessLabels. - * @member {Array.} bestGuessLabels - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @instance - */ - WebDetection.prototype.bestGuessLabels = $util.emptyArray; - - /** - * Creates a new WebDetection instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p3beta1.IWebDetection=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.WebDetection} WebDetection instance - */ - WebDetection.create = function create(properties) { - return new WebDetection(properties); - }; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.WebDetection.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.WebDetection.WebEntity.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 4: { - if (!(message.pagesWithMatchingImages && message.pagesWithMatchingImages.length)) - message.pagesWithMatchingImages = []; - message.pagesWithMatchingImages.push($root.google.cloud.vision.v1p3beta1.WebDetection.WebPage.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.visuallySimilarImages && message.visuallySimilarImages.length)) - message.visuallySimilarImages = []; - message.visuallySimilarImages.push($root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 8: { - if (!(message.bestGuessLabels && message.bestGuessLabels.length)) - message.bestGuessLabels = []; - message.bestGuessLabels.push($root.google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.WebDetection - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.WebDetection} WebDetection - */ - WebDetection.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.WebDetection) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.WebDetection(); - if (object.webEntities) { - if (!Array.isArray(object.webEntities)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.webEntities: object expected"); - message.webEntities[i] = $root.google.cloud.vision.v1p3beta1.WebDetection.WebEntity.fromObject(object.webEntities[i]); - } - } - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - if (object.pagesWithMatchingImages) { - if (!Array.isArray(object.pagesWithMatchingImages)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.pagesWithMatchingImages: object expected"); - message.pagesWithMatchingImages[i] = $root.google.cloud.vision.v1p3beta1.WebDetection.WebPage.fromObject(object.pagesWithMatchingImages[i]); - } - } - if (object.visuallySimilarImages) { - if (!Array.isArray(object.visuallySimilarImages)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.visuallySimilarImages: object expected"); - message.visuallySimilarImages[i] = $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.fromObject(object.visuallySimilarImages[i]); - } - } - if (object.bestGuessLabels) { - if (!Array.isArray(object.bestGuessLabels)) - throw TypeError(".google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.bestGuessLabels: object expected"); - message.bestGuessLabels[i] = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.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.v1p3beta1.WebDetection.WebLabel.toObject(message.bestGuessLabels[j], options); - } - return object; - }; - - /** - * Converts this WebDetection to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @instance - * @returns {Object.} JSON object - */ - WebDetection.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetection - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.WebDetection"; - }; - - WebDetection.WebEntity = (function() { - - /** - * Properties of a WebEntity. - * @memberof google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection - * @classdesc Represents a WebEntity. - * @implements IWebEntity - * @constructor - * @param {google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.entityId = ""; - - /** - * WebEntity score. - * @member {number} score - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.score = 0; - - /** - * WebEntity description. - * @member {string} description - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.description = ""; - - /** - * Creates a new WebEntity instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebEntity=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.WebEntity.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p3beta1.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 && Object.hasOwnProperty.call(message, "entityId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.entityId); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - return writer; - }; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebEntity.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebEntity} message WebEntity message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebEntity.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @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.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decode = function decode(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.WebDetection.WebEntity(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.entityId = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.description = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebEntity message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebEntity.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.entityId != null && message.hasOwnProperty("entityId")) - if (!$util.isString(message.entityId)) - return "entityId: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - return null; - }; - - /** - * Creates a WebEntity message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebEntity} WebEntity - */ - WebEntity.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.WebDetection.WebEntity) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.WebDetection.WebEntity(); - if (object.entityId != null) - message.entityId = String(object.entityId); - if (object.score != null) - message.score = Number(object.score); - if (object.description != null) - message.description = String(object.description); - return message; - }; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.WebEntity} message WebEntity - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebEntity.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.entityId = ""; - object.score = 0; - object.description = ""; - } - if (message.entityId != null && message.hasOwnProperty("entityId")) - object.entityId = message.entityId; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - return object; - }; - - /** - * Converts this WebEntity to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @instance - * @returns {Object.} JSON object - */ - WebEntity.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebEntity - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebEntity - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebEntity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.WebDetection.WebEntity"; - }; - - return WebEntity; - })(); - - WebDetection.WebImage = (function() { - - /** - * Properties of a WebImage. - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @interface IWebImage - * @property {string|null} [url] WebImage url - * @property {number|null} [score] WebImage score - */ - - /** - * Constructs a new WebImage. - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @classdesc Represents a WebImage. - * @implements IWebImage - * @constructor - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebImage=} [properties] Properties to set - */ - function WebImage(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]]; - } - - /** - * WebImage url. - * @member {string} url - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.url = ""; - - /** - * WebImage score. - * @member {number} score - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.score = 0; - - /** - * Creates a new WebImage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebImage} WebImage instance - */ - WebImage.create = function create(properties) { - return new WebImage(properties); - }; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebImage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - return writer; - }; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebImage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @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.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decode = function decode(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.WebDetection.WebImage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebImage message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebImage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - return null; - }; - - /** - * Creates a WebImage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebImage} WebImage - */ - WebImage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - return message; - }; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.WebImage} message WebImage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebImage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.url = ""; - object.score = 0; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - return object; - }; - - /** - * Converts this WebImage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @instance - * @returns {Object.} JSON object - */ - WebImage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebImage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebImage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebImage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.WebDetection.WebImage"; - }; - - return WebImage; - })(); - - WebDetection.WebPage = (function() { - - /** - * Properties of a WebPage. - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @interface IWebPage - * @property {string|null} [url] WebPage url - * @property {number|null} [score] WebPage score - * @property {string|null} [pageTitle] WebPage pageTitle - * @property {Array.|null} [fullMatchingImages] WebPage fullMatchingImages - * @property {Array.|null} [partialMatchingImages] WebPage partialMatchingImages - */ - - /** - * Constructs a new WebPage. - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @classdesc Represents a WebPage. - * @implements IWebPage - * @constructor - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebPage=} [properties] Properties to set - */ - function WebPage(properties) { - this.fullMatchingImages = []; - this.partialMatchingImages = []; - 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]]; - } - - /** - * WebPage url. - * @member {string} url - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.url = ""; - - /** - * WebPage score. - * @member {number} score - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.score = 0; - - /** - * WebPage pageTitle. - * @member {string} pageTitle - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.pageTitle = ""; - - /** - * WebPage fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebPage partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.partialMatchingImages = $util.emptyArray; - - /** - * Creates a new WebPage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebPage} WebPage instance - */ - WebPage.create = function create(properties) { - return new WebPage(properties); - }; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebPage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pageTitle != null && Object.hasOwnProperty.call(message, "pageTitle")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageTitle); - if (message.fullMatchingImages != null && message.fullMatchingImages.length) - for (var i = 0; i < message.fullMatchingImages.length; ++i) - $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.encode(message.fullMatchingImages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.partialMatchingImages != null && message.partialMatchingImages.length) - for (var i = 0; i < message.partialMatchingImages.length; ++i) - $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.encode(message.partialMatchingImages[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebPage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @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.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decode = function decode(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.WebDetection.WebPage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.pageTitle = reader.string(); - break; - } - case 4: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebPage message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebPage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - if (!$util.isString(message.pageTitle)) - return "pageTitle: string expected"; - 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.v1p3beta1.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.v1p3beta1.WebDetection.WebImage.verify(message.partialMatchingImages[i]); - if (error) - return "partialMatchingImages." + error; - } - } - return null; - }; - - /** - * Creates a WebPage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebPage} WebPage - */ - WebPage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.WebDetection.WebPage) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.WebDetection.WebPage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - if (object.pageTitle != null) - message.pageTitle = String(object.pageTitle); - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1p3beta1.WebDetection.WebPage.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.v1p3beta1.WebDetection.WebPage.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1p3beta1.WebDetection.WebPage.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.v1p3beta1.WebDetection.WebPage.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1p3beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.WebPage} message WebPage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebPage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.fullMatchingImages = []; - object.partialMatchingImages = []; - } - if (options.defaults) { - object.url = ""; - object.score = 0; - object.pageTitle = ""; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - object.pageTitle = message.pageTitle; - if (message.fullMatchingImages && message.fullMatchingImages.length) { - object.fullMatchingImages = []; - for (var j = 0; j < message.fullMatchingImages.length; ++j) - object.fullMatchingImages[j] = $root.google.cloud.vision.v1p3beta1.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.v1p3beta1.WebDetection.WebImage.toObject(message.partialMatchingImages[j], options); - } - return object; - }; - - /** - * Converts this WebPage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @instance - * @returns {Object.} JSON object - */ - WebPage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebPage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebPage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebPage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.WebDetection.WebPage"; - }; - - return WebPage; - })(); - - WebDetection.WebLabel = (function() { - - /** - * Properties of a WebLabel. - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @interface IWebLabel - * @property {string|null} [label] WebLabel label - * @property {string|null} [languageCode] WebLabel languageCode - */ - - /** - * Constructs a new WebLabel. - * @memberof google.cloud.vision.v1p3beta1.WebDetection - * @classdesc Represents a WebLabel. - * @implements IWebLabel - * @constructor - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebLabel=} [properties] Properties to set - */ - function WebLabel(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]]; - } - - /** - * WebLabel label. - * @member {string} label - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.label = ""; - - /** - * WebLabel languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.languageCode = ""; - - /** - * Creates a new WebLabel instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebLabel=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebLabel} WebLabel instance - */ - WebLabel.create = function create(properties) { - return new WebLabel(properties); - }; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebLabel.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.label); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - return writer; - }; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetection.WebLabel.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @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.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decode = function decode(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.WebDetection.WebLabel(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.label = reader.string(); - break; - } - case 2: { - message.languageCode = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebLabel message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebLabel.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.label != null && message.hasOwnProperty("label")) - if (!$util.isString(message.label)) - return "label: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - return null; - }; - - /** - * Creates a WebLabel message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.WebDetection.WebLabel} WebLabel - */ - WebLabel.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.WebDetection.WebLabel) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.WebDetection.WebLabel(); - if (object.label != null) - message.label = String(object.label); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - return message; - }; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p3beta1.WebDetection.WebLabel} message WebLabel - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebLabel.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - 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; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for WebLabel - * @function getTypeUrl - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebLabel.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p3beta1.WebDetection.WebLabel"; - }; - - 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; - }; - - /** - * 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()); - }; - - /** - * 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; - }; - - /** - * 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; - }; - - /** - * 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; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for FaceRecognitionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FaceRecognitionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.FaceRecognitionParams"; - }; - - return FaceRecognitionParams; - })(); - - v1p4beta1.Celebrity = (function() { - - /** - * Properties of a Celebrity. - * @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 - */ - - /** - * 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 - */ - 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]]; - } - - /** - * 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 - * @instance - */ - Celebrity.prototype.description = ""; - - /** - * 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); - }; - - /** - * 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 - */ - Celebrity.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - return writer; - }; - - /** - * 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(); - }; - - /** - * 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; - }; - - /** - * 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 - */ - Celebrity.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * 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; - }; - - /** - * 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; - }; - - /** - * 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 - */ - 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; - }; - - /** - * Converts this Celebrity to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Celebrity - * @instance - * @returns {Object.} JSON object - */ - Celebrity.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Celebrity - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Celebrity - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Celebrity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Celebrity"; - }; - - return Celebrity; - })(); - - v1p4beta1.FaceRecognitionResult = (function() { - - /** - * Properties of a FaceRecognitionResult. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IFaceRecognitionResult - * @property {google.cloud.vision.v1p4beta1.ICelebrity|null} [celebrity] FaceRecognitionResult celebrity - * @property {number|null} [confidence] FaceRecognitionResult confidence - */ - - /** - * Constructs a new FaceRecognitionResult. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a FaceRecognitionResult. - * @implements IFaceRecognitionResult - * @constructor - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult=} [properties] Properties to set - */ - function FaceRecognitionResult(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]]; - } - - /** - * FaceRecognitionResult celebrity. - * @member {google.cloud.vision.v1p4beta1.ICelebrity|null|undefined} celebrity - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @instance - */ - FaceRecognitionResult.prototype.celebrity = null; - - /** - * FaceRecognitionResult confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @instance - */ - FaceRecognitionResult.prototype.confidence = 0; - - /** - * Creates a new FaceRecognitionResult instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @static - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult instance - */ - FaceRecognitionResult.create = function create(properties) { - return new FaceRecognitionResult(properties); - }; - - /** - * Encodes the specified FaceRecognitionResult message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @static - * @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 - */ - FaceRecognitionResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.celebrity != null && Object.hasOwnProperty.call(message, "celebrity")) - $root.google.cloud.vision.v1p4beta1.Celebrity.encode(message.celebrity, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - return writer; - }; - - /** - * 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.FaceRecognitionResult - * @static - * @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 - */ - FaceRecognitionResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FaceRecognitionResult message from the specified reader or buffer. - * @function decode - * @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.FaceRecognitionResult} FaceRecognitionResult - * @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) { - 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(); - 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()); - break; - } - case 2: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FaceRecognitionResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - FaceRecognitionResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FaceRecognitionResult message. - * @function verify - * @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 - */ - FaceRecognitionResult.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 (error) - return "celebrity." + error; - } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - return null; - }; - - /** - * Creates a FaceRecognitionResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult - */ - FaceRecognitionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult) - 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); - } - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; - - /** - * Creates a plain object from a FaceRecognitionResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @static - * @param {google.cloud.vision.v1p4beta1.FaceRecognitionResult} message FaceRecognitionResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FaceRecognitionResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.celebrity = null; - object.confidence = 0; - } - 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 FaceRecognitionResult to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @instance - * @returns {Object.} JSON object - */ - FaceRecognitionResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FaceRecognitionResult - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FaceRecognitionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.FaceRecognitionResult"; - }; - - return FaceRecognitionResult; - })(); - - v1p4beta1.Vertex = (function() { - - /** - * Properties of a Vertex. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y - */ - - /** - * Constructs a new Vertex. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Vertex. - * @implements IVertex - * @constructor - * @param {google.cloud.vision.v1p4beta1.IVertex=} [properties] Properties to set - */ - 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]]; - } - - /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p4beta1.Vertex - * @instance - */ - Vertex.prototype.x = 0; - - /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p4beta1.Vertex - * @instance - */ - Vertex.prototype.y = 0; - - /** - * Creates a new Vertex instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Vertex - * @static - * @param {google.cloud.vision.v1p4beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex instance - */ - Vertex.create = function create(properties) { - return new Vertex(properties); - }; - - /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Vertex - * @static - * @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 - */ - Vertex.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); - return writer; - }; - - /** - * 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.Vertex - * @static - * @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 - */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Vertex message from the specified reader or buffer. - * @function decode - * @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.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.v1p4beta1.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; - }; - - /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Vertex - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Vertex.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Vertex message. - * @function verify - * @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 - */ - 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; - }; - - /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Vertex - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex - */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Vertex) - 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; - return message; - }; - - /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Vertex - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.Vertex - * @instance - * @returns {Object.} JSON object - */ - Vertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Vertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Vertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Vertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Vertex"; - }; - - return Vertex; - })(); - - v1p4beta1.NormalizedVertex = (function() { - - /** - * Properties of a NormalizedVertex. - * @memberof google.cloud.vision.v1p4beta1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y - */ - - /** - * Constructs a new NormalizedVertex. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex - * @constructor - * @param {google.cloud.vision.v1p4beta1.INormalizedVertex=} [properties] Properties to set - */ - function NormalizedVertex(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]]; - } - - /** - * 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 - * @instance - */ - NormalizedVertex.prototype.y = 0; - - /** - * Creates a new NormalizedVertex instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex - * @static - * @param {google.cloud.vision.v1p4beta1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex instance - */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); - }; - - /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex - * @static - * @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 - */ - NormalizedVertex.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - return writer; - }; - - /** - * 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.NormalizedVertex - * @static - * @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 - */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer. - * @function decode - * @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.NormalizedVertex} NormalizedVertex - * @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) { - 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(); - 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; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NormalizedVertex message. - * @function verify - * @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 - */ - NormalizedVertex.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"; - return null; - }; - - /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex - */ - 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 a NormalizedVertex message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex - * @static - * @param {google.cloud.vision.v1p4beta1.NormalizedVertex} message NormalizedVertex - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NormalizedVertex.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; - return object; - }; - - /** - * Converts this NormalizedVertex to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex - * @instance - * @returns {Object.} JSON object - */ - NormalizedVertex.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NormalizedVertex - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NormalizedVertex.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.NormalizedVertex"; - }; - - return NormalizedVertex; - })(); - - v1p4beta1.BoundingPoly = (function() { - - /** - * Properties of a BoundingPoly. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices - */ - - /** - * Constructs a new BoundingPoly. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly - * @constructor - * @param {google.cloud.vision.v1p4beta1.IBoundingPoly=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * 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 - * @instance - */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly - * @static - * @param {google.cloud.vision.v1p4beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly instance - */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); - }; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly - * @static - * @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 - */ - BoundingPoly.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(); - return writer; - }; - - /** - * 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.BoundingPoly - * @static - * @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 - */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @function decode - * @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.BoundingPoly} BoundingPoly - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BoundingPoly message. - * @function verify - * @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 - */ - BoundingPoly.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; - } - } - return null; - }; - - /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly - */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BoundingPoly) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly - * @static - * @param {google.cloud.vision.v1p4beta1.BoundingPoly} message BoundingPoly - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoundingPoly.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); - } - return object; - }; - - /** - * Converts this BoundingPoly to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly - * @instance - * @returns {Object.} JSON object - */ - BoundingPoly.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BoundingPoly - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BoundingPoly.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.BoundingPoly"; - }; - - return BoundingPoly; - })(); - - v1p4beta1.Position = (function() { - - /** - * 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 - */ - - /** - * 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]]; - } - - /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1p4beta1.Position - * @instance - */ - Position.prototype.x = 0; - - /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1p4beta1.Position - * @instance - */ - Position.prototype.y = 0; - - /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1p4beta1.Position - * @instance - */ - Position.prototype.z = 0; - - /** - * 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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && Object.hasOwnProperty.call(message, "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.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(); - }; - - /** - * 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.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; - }; - - /** - * 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()); - }; - - /** - * 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; - }; - - /** - * 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; - }; - - /** - * 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; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for Position - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Position - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Position.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Position"; - }; - - return Position; - })(); - - v1p4beta1.ImageAnnotator = (function() { - - /** - * Constructs a new ImageAnnotator service. - * @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 - */ - 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. - */ - 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 - */ - - /** - * 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 - */ - 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" }); - - /** - * 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 - */ - - /** - * 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 - */ - - /** - * 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 - */ - 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" }); - - /** - * 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 - */ - - /** - * 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 - */ - - /** - * 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 - */ - 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" }); - - /** - * 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 - */ - - /** - * 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 - */ - - /** - * 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 - */ - 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" }); - - /** - * 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.Feature = (function() { - - /** - * Properties of a Feature. - * @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 - */ - - /** - * Constructs a new Feature. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Feature. - * @implements IFeature - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.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 - * @instance - */ - Feature.prototype.maxResults = 0; - - /** - * Feature model. - * @member {string} model - * @memberof google.cloud.vision.v1p4beta1.Feature - * @instance - */ - Feature.prototype.model = ""; - - /** - * Creates a new Feature instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Feature - * @static - * @param {google.cloud.vision.v1p4beta1.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Feature} Feature instance - */ - Feature.create = function create(properties) { - return new Feature(properties); - }; - - /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Feature - * @static - * @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 - */ - Feature.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && Object.hasOwnProperty.call(message, "model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); - return writer; - }; - - /** - * 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.Feature - * @static - * @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 - */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Feature message from the specified reader or buffer. - * @function decode - * @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.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.v1p4beta1.Feature(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type = reader.int32(); - break; - } - case 2: { - message.maxResults = reader.int32(); - break; - } - case 3: { - message.model = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Feature message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Feature - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p4beta1.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.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.v1p4beta1.Feature - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Feature} Feature - */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Feature) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Feature(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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 Feature message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Feature - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.Feature.Type[message.type] === undefined ? message.type : $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 Feature to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Feature - * @instance - * @returns {Object.} JSON object - */ - Feature.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Feature - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Feature - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Feature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Feature"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p4beta1.Feature.Type - * @enum {number} - * @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; - })(); - - v1p4beta1.ImageSource = (function() { - - /** - * Properties of an ImageSource. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri - */ - - /** - * Constructs a new ImageSource. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageSource. - * @implements IImageSource - * @constructor - * @param {google.cloud.vision.v1p4beta1.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]]; - } - - /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @instance - */ - ImageSource.prototype.gcsImageUri = ""; - - /** - * ImageSource imageUri. - * @member {string} imageUri - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @instance - */ - ImageSource.prototype.imageUri = ""; - - /** - * Creates a new ImageSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @static - * @param {google.cloud.vision.v1p4beta1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource instance - */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); - }; - - /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @static - * @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 - */ - ImageSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsImageUri != null && Object.hasOwnProperty.call(message, "gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); - return writer; - }; - - /** - * 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.ImageSource - * @static - * @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 - */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer. - * @function decode - * @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.ImageSource} ImageSource - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsImageUri = reader.string(); - break; - } - case 2: { - message.imageUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageSource message. - * @function verify - * @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 - */ - ImageSource.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"; - return null; - }; - - /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource - */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageSource) - 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); - return message; - }; - - /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @static - * @param {google.cloud.vision.v1p4beta1.ImageSource} message ImageSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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 ImageSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @instance - * @returns {Object.} JSON object - */ - ImageSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ImageSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ImageSource"; - }; - - return ImageSource; - })(); - - v1p4beta1.Image = (function() { - - /** - * Properties of an Image. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1p4beta1.IImageSource|null} [source] Image source - */ - - /** - * Constructs a new Image. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an Image. - * @implements IImage - * @constructor - * @param {google.cloud.vision.v1p4beta1.IImage=} [properties] Properties to set - */ - function Image(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]]; - } - - /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1p4beta1.Image - * @instance - */ - Image.prototype.content = $util.newBuffer([]); - - /** - * Image source. - * @member {google.cloud.vision.v1p4beta1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1p4beta1.Image - * @instance - */ - Image.prototype.source = null; - - /** - * Creates a new Image instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Image - * @static - * @param {google.cloud.vision.v1p4beta1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Image} Image instance - */ - Image.create = function create(properties) { - return new Image(properties); - }; - - /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Image - * @static - * @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 - */ - Image.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && Object.hasOwnProperty.call(message, "source")) - $root.google.cloud.vision.v1p4beta1.ImageSource.encode(message.source, 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.v1p4beta1.Image.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Image - * @static - * @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 - */ - Image.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Image message from the specified reader or buffer. - * @function decode - * @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.Image} Image - * @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) { - 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(); - 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.v1p4beta1.ImageSource.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Image message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Image - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Image.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Image message. - * @function verify - * @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 - */ - Image.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; - } - return null; - }; - - /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Image - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Image} Image - */ - 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 >= 0) - 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 an Image message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Image - * @static - * @param {google.cloud.vision.v1p4beta1.Image} message Image - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Image.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 (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 Image to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Image - * @instance - * @returns {Object.} JSON object - */ - Image.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Image - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Image - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Image.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Image"; - }; - - return Image; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1p4beta1.Likelihood - * @enum {number} - * @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 FaceAnnotation. - * @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 - */ - - /** - * Constructs a new FaceAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation - * @constructor - * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * 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 - * @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.FaceAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation instance - */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); - }; - - /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @static - * @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 - */ - FaceAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && Object.hasOwnProperty.call(message, "panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && Object.hasOwnProperty.call(message, "tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && Object.hasOwnProperty.call(message, "detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && Object.hasOwnProperty.call(message, "landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && Object.hasOwnProperty.call(message, "joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && Object.hasOwnProperty.call(message, "sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && Object.hasOwnProperty.call(message, "angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && Object.hasOwnProperty.call(message, "surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && Object.hasOwnProperty.call(message, "underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && Object.hasOwnProperty.call(message, "blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && Object.hasOwnProperty.call(message, "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 FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @static - * @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 - */ - 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.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.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.v1p4beta1.FaceAnnotation(); - 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()); - 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: - 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 (error) - return "recognitionResult." + error; - } - } - return null; - }; - - /** - * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation - */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceAnnotation) - 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]); - } - } - 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) { - default: - if (typeof object.joyLikelihood === "number") { - message.joyLikelihood = object.joyLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.sorrowLikelihood === "number") { - message.sorrowLikelihood = object.sorrowLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.angerLikelihood === "number") { - message.angerLikelihood = object.angerLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.surpriseLikelihood === "number") { - message.surpriseLikelihood = object.surpriseLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.underExposedLikelihood === "number") { - message.underExposedLikelihood = object.underExposedLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.blurredLikelihood === "number") { - message.blurredLikelihood = object.blurredLikelihood; - break; - } - break; - 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) { - default: - if (typeof object.headwearLikelihood === "number") { - message.headwearLikelihood = object.headwearLikelihood; - break; - } - break; - 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 FaceAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.FaceAnnotation} message FaceAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FaceAnnotation.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; - } - 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] === undefined ? message.joyLikelihood : $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] === undefined ? message.sorrowLikelihood : $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] === undefined ? message.angerLikelihood : $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] === undefined ? message.surpriseLikelihood : $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] === undefined ? message.underExposedLikelihood : $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] === undefined ? message.blurredLikelihood : $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] === undefined ? message.headwearLikelihood : $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); - } - return object; - }; - - /** - * Converts this FaceAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - * @returns {Object.} JSON object - */ - FaceAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FaceAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FaceAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.FaceAnnotation"; - }; - - 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 - */ - - /** - * 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]]; - } - - /** - * Landmark type. - * @member {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 0; - - /** - * Landmark position. - * @member {google.cloud.vision.v1p4beta1.IPosition|null|undefined} position - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.position = 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); - }; - - /** - * 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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && Object.hasOwnProperty.call(message, "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; - }; - - /** - * 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()); - }; - - /** - * 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; - }; - - /** - * 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) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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.v1p4beta1.FaceAnnotation.Landmark.position: object expected"); - message.position = $root.google.cloud.vision.v1p4beta1.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.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] === undefined ? message.type : $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; - }; - - /** - * 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); - }; - - /** - * Gets the default type url for Landmark - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Landmark.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark"; - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type - * @enum {number} - * @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; - })(); - - v1p4beta1.LocationInfo = (function() { - - /** - * Properties of a LocationInfo. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng - */ - - /** - * 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 - */ - 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 - * @instance - */ - LocationInfo.prototype.latLng = null; - - /** - * 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 - */ - 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 - */ - LocationInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLng != null && Object.hasOwnProperty.call(message, "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 - */ - 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.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 - */ - 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 - */ - 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 - */ - 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.v1p4beta1.LocationInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo - */ - 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 - */ - 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 - * @instance - * @returns {Object.} JSON object - */ - LocationInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocationInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.LocationInfo"; - }; - - return LocationInfo; - })(); - - v1p4beta1.Property = (function() { - - /** - * Properties of a Property. - * @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 - */ - - /** - * Constructs a new Property. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Property. - * @implements IProperty - * @constructor - * @param {google.cloud.vision.v1p4beta1.IProperty=} [properties] Properties to set - */ - function Property(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * 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.Property - * @static - * @param {google.cloud.vision.v1p4beta1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Property} Property instance - */ - Property.create = function create(properties) { - return new Property(properties); - }; - - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Property - * @static - * @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 - */ - Property.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && Object.hasOwnProperty.call(message, "uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); - return writer; - }; - - /** - * 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.Property - * @static - * @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 - */ - Property.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Property message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.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.Property} Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Property.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.Property(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - case 3: { - message.uint64Value = reader.uint64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Property - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - Property.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Property message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.Property - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Property.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.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 Property message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Property - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Property} Property - */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Property) - 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); - return message; - }; - - /** - * Creates a plain object from a Property message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Property - * @static - * @param {google.cloud.vision.v1p4beta1.Property} message Property - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Property.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.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 Property to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Property - * @instance - * @returns {Object.} JSON object - */ - Property.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Property - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Property - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Property"; - }; - - return Property; - })(); - - v1p4beta1.EntityAnnotation = (function() { - - /** - * Properties of an EntityAnnotation. - * @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 - */ - - /** - * Constructs a new EntityAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation - * @constructor - * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * 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 - * @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.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation instance - */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); - }; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @static - * @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 - */ - EntityAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && Object.hasOwnProperty.call(message, "locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && Object.hasOwnProperty.call(message, "topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "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 EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @static - * @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 - */ - EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer. - * @function decode - * @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.EntityAnnotation} EntityAnnotation - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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); - break; - } - } - return message; - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p4beta1.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.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; - } - } - return null; - }; - - /** - * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation - */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.EntityAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.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.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 EntityAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @instance - * @returns {Object.} JSON object - */ - EntityAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EntityAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EntityAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.EntityAnnotation"; - }; - - return EntityAnnotation; - })(); - - v1p4beta1.LocalizedObjectAnnotation = (function() { - - /** - * Properties of a LocalizedObjectAnnotation. - * @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 - */ - - /** - * Constructs a new LocalizedObjectAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a LocalizedObjectAnnotation. - * @implements ILocalizedObjectAnnotation - * @constructor - * @param {google.cloud.vision.v1p4beta1.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]]; - } - - /** - * 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 - * @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.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation instance - */ - LocalizedObjectAnnotation.create = function create(properties) { - return new LocalizedObjectAnnotation(properties); - }; - - /** - * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation - * @static - * @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 - */ - LocalizedObjectAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * 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.LocalizedObjectAnnotation - * @static - * @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 - */ - LocalizedObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. - * @function decode - * @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.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.v1p4beta1.LocalizedObjectAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.LocalizedObjectAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation - */ - LocalizedObjectAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation) - 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); - } - return message; - }; - - /** - * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); - return object; - }; - - /** - * Converts this LocalizedObjectAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation - * @instance - * @returns {Object.} JSON object - */ - LocalizedObjectAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocalizedObjectAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocalizedObjectAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation"; - }; - - return LocalizedObjectAnnotation; - })(); - - v1p4beta1.SafeSearchAnnotation = (function() { - - /** - * Properties of a SafeSearchAnnotation. - * @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 - */ - - /** - * Constructs a new SafeSearchAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.Likelihood} adult - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.adult = 0; - - /** - * 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.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation instance - */ - SafeSearchAnnotation.create = function create(properties) { - return new SafeSearchAnnotation(properties); - }; - - /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation - * @static - * @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 - */ - SafeSearchAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.adult != null && Object.hasOwnProperty.call(message, "adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && Object.hasOwnProperty.call(message, "spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && Object.hasOwnProperty.call(message, "medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && Object.hasOwnProperty.call(message, "violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && Object.hasOwnProperty.call(message, "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.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation - * @static - * @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 - */ - 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.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.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.v1p4beta1.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; - }; - - /** - * 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) { - 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.v1p4beta1.SafeSearchAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation - */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation(); - switch (object.adult) { - default: - if (typeof object.adult === "number") { - message.adult = object.adult; - break; - } - break; - 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) { - default: - if (typeof object.spoof === "number") { - message.spoof = object.spoof; - break; - } - break; - 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) { - default: - if (typeof object.medical === "number") { - message.medical = object.medical; - break; - } - break; - 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) { - default: - if (typeof object.violence === "number") { - message.violence = object.violence; - break; - } - break; - 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) { - default: - if (typeof object.racy === "number") { - message.racy = object.racy; - break; - } - break; - 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 SafeSearchAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} message SafeSearchAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SafeSearchAnnotation.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.v1p4beta1.Likelihood[message.adult] === undefined ? message.adult : $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] === undefined ? message.spoof : $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] === undefined ? message.medical : $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] === undefined ? message.violence : $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] === undefined ? message.racy : $root.google.cloud.vision.v1p4beta1.Likelihood[message.racy] : message.racy; - return object; - }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation - * @instance - * @returns {Object.} JSON object - */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SafeSearchAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SafeSearchAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.SafeSearchAnnotation"; - }; - - return SafeSearchAnnotation; - })(); - - v1p4beta1.LatLongRect = (function() { - - /** - * 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 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]]; - } - - /** - * LatLongRect minLatLng. - * @member {google.type.ILatLng|null|undefined} minLatLng - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.minLatLng = null; - - /** - * 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.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 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 && Object.hasOwnProperty.call(message, "minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && Object.hasOwnProperty.call(message, "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.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(); - }; - - /** - * 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) { - 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.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; - }; - - /** - * 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) - 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 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); - }; - - /** - * Gets the default type url for LatLongRect - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LatLongRect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.LatLongRect"; - }; - - return LatLongRect; - })(); - - v1p4beta1.ColorInfo = (function() { - - /** - * Properties of a ColorInfo. - * @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 - */ - - /** - * Constructs a new ColorInfo. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo - * @constructor - * @param {google.cloud.vision.v1p4beta1.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]]; - } - - /** - * 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 - * @instance - */ - ColorInfo.prototype.pixelFraction = 0; - - /** - * Creates a new ColorInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p4beta1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo instance - */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); - }; - - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ColorInfo - * @static - * @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 - */ - ColorInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.color != null && Object.hasOwnProperty.call(message, "color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && Object.hasOwnProperty.call(message, "pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); - return writer; - }; - - /** - * 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.ColorInfo - * @static - * @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 - */ - ColorInfo.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.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.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.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.score = reader.float(); - break; - } - case 3: { - message.pixelFraction = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ColorInfo.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.v1p4beta1.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; - }; - - /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ColorInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo - */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ColorInfo) - 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); - } - 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.v1p4beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p4beta1.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 ColorInfo to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ColorInfo - * @instance - * @returns {Object.} JSON object - */ - ColorInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ColorInfo - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ColorInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ColorInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ColorInfo"; - }; - - return ColorInfo; - })(); - - v1p4beta1.DominantColorsAnnotation = (function() { - - /** - * Properties of a DominantColorsAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors - */ - - /** - * Constructs a new DominantColorsAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation - * @constructor - * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation=} [properties] Properties to set - */ - function DominantColorsAnnotation(properties) { - this.colors = []; - 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]]; - } - - /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @instance - */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; - - /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation instance - */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); - }; - - /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @static - * @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 - */ - 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.v1p4beta1.ColorInfo.encode(message.colors[i], 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.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @static - * @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 - */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. - * @function decode - * @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.DominantColorsAnnotation} DominantColorsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DominantColorsAnnotation message. - * @function verify - * @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 - */ - DominantColorsAnnotation.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; - } - } - return null; - }; - - /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation - */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} message DominantColorsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DominantColorsAnnotation.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); - } - return object; - }; - - /** - * Converts this DominantColorsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @instance - * @returns {Object.} JSON object - */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DominantColorsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DominantColorsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.DominantColorsAnnotation"; - }; - - return DominantColorsAnnotation; - })(); - - v1p4beta1.ImageProperties = (function() { - - /** - * Properties of an ImageProperties. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IImageProperties - * @property {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors - */ - - /** - * Constructs a new ImageProperties. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties - * @constructor - * @param {google.cloud.vision.v1p4beta1.IImageProperties=} [properties] Properties to set - */ - 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]]; - } - - /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1p4beta1.ImageProperties - * @instance - */ - ImageProperties.prototype.dominantColors = null; - - /** - * Creates a new ImageProperties instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ImageProperties - * @static - * @param {google.cloud.vision.v1p4beta1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties instance - */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); - }; - - /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImageProperties - * @static - * @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 - */ - ImageProperties.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dominantColors != null && Object.hasOwnProperty.call(message, "dominantColors")) - $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageProperties - * @static - * @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 - */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer. - * @function decode - * @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.ImageProperties} ImageProperties - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageProperties - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageProperties message. - * @function verify - * @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 - */ - ImageProperties.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 (error) - return "dominantColors." + error; - } - return null; - }; - - /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImageProperties - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties - */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageProperties) - 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); - } - return message; - }; - - /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImageProperties - * @static - * @param {google.cloud.vision.v1p4beta1.ImageProperties} message ImageProperties - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageProperties.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); - return object; - }; - - /** - * Converts this ImageProperties to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImageProperties - * @instance - * @returns {Object.} JSON object - */ - ImageProperties.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageProperties - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ImageProperties - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ImageProperties"; - }; - - return ImageProperties; - })(); - - v1p4beta1.CropHint = (function() { - - /** - * Properties of a CropHint. - * @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 - */ - - /** - * Constructs a new CropHint. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CropHint. - * @implements ICropHint - * @constructor - * @param {google.cloud.vision.v1p4beta1.ICropHint=} [properties] Properties to set - */ - function CropHint(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]]; - } - - /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p4beta1.CropHint - * @instance - */ - CropHint.prototype.boundingPoly = null; - - /** - * CropHint confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.CropHint - * @instance - */ - CropHint.prototype.confidence = 0; - - /** - * 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.CropHint - * @static - * @param {google.cloud.vision.v1p4beta1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint instance - */ - CropHint.create = function create(properties) { - return new CropHint(properties); - }; - - /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.CropHint - * @static - * @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 - */ - CropHint.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && Object.hasOwnProperty.call(message, "importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); - return writer; - }; - - /** - * 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.CropHint - * @static - * @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 - */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHint message from the specified reader or buffer. - * @function decode - * @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.CropHint} CropHint - * @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) { - 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(); - 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()); - break; - } - case 2: { - message.confidence = reader.float(); - break; - } - case 3: { - message.importanceFraction = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHint - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHint.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHint message. - * @function verify - * @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 - */ - CropHint.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.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. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CropHint - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint - */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHint) - return object; - 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 a CropHint message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CropHint - * @static - * @param {google.cloud.vision.v1p4beta1.CropHint} message CropHint - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHint.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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.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. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CropHint - * @instance - * @returns {Object.} JSON object - */ - CropHint.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHint - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.CropHint - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.CropHint"; - }; - - return CropHint; - })(); - - v1p4beta1.CropHintsAnnotation = (function() { - - /** - * Properties of a CropHintsAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints - */ - - /** - * Constructs a new CropHintsAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation - * @constructor - * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation=} [properties] Properties to set - */ - 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]]; - } - - /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation - * @instance - */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; - - /** - * Creates a new CropHintsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation instance - */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); - }; - - /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.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(); - return writer; - }; - - /** - * 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.CropHintsAnnotation - * @static - * @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 - */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. - * @function decode - * @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.CropHintsAnnotation} CropHintsAnnotation - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsAnnotation message. - * @function verify - * @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 - */ - CropHintsAnnotation.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; - } - } - return null; - }; - - /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation - */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.CropHintsAnnotation} message CropHintsAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsAnnotation.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); - } - return object; - }; - - /** - * Converts this CropHintsAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation - * @instance - * @returns {Object.} JSON object - */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.CropHintsAnnotation"; - }; - - return CropHintsAnnotation; - })(); - - v1p4beta1.CropHintsParams = (function() { - - /** - * Properties of a CropHintsParams. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios - */ - - /** - * Constructs a new CropHintsParams. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams - * @constructor - * @param {google.cloud.vision.v1p4beta1.ICropHintsParams=} [properties] Properties to set - */ - function CropHintsParams(properties) { - this.aspectRatios = []; - 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]]; - } - - /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams - * @instance - */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; - - /** - * Creates a new CropHintsParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams - * @static - * @param {google.cloud.vision.v1p4beta1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams instance - */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); - }; - - /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams - * @static - * @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 - */ - CropHintsParams.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(); - } - return writer; - }; - - /** - * 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.CropHintsParams - * @static - * @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 - */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer. - * @function decode - * @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.CropHintsParams} CropHintsParams - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CropHintsParams message. - * @function verify - * @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 - */ - CropHintsParams.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"; - } - return null; - }; - - /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams - */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHintsParams) - 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]); - } - return message; - }; - - /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams - * @static - * @param {google.cloud.vision.v1p4beta1.CropHintsParams} message CropHintsParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CropHintsParams.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]; - } - return object; - }; - - /** - * Converts this CropHintsParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams - * @instance - * @returns {Object.} JSON object - */ - CropHintsParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CropHintsParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CropHintsParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.CropHintsParams"; - }; - - return CropHintsParams; - })(); - - v1p4beta1.WebDetectionParams = (function() { - - /** - * Properties of a WebDetectionParams. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults - */ - - /** - * Constructs a new WebDetectionParams. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams - * @constructor - * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams=} [properties] Properties to set - */ - function WebDetectionParams(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]]; - } - - /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams - * @instance - */ - WebDetectionParams.prototype.includeGeoResults = false; - - /** - * Creates a new WebDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams instance - */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); - }; - - /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.includeGeoResults != null && Object.hasOwnProperty.call(message, "includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); - return writer; - }; - - /** - * 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.WebDetectionParams - * @static - * @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 - */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebDetectionParams message from the specified reader or buffer. - * @function decode - * @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.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.v1p4beta1.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.v1p4beta1.WebDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p4beta1.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 a WebDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams - */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.WebDetectionParams) - return object; - 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 WebDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetectionParams} message WebDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebDetectionParams.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; - return object; - }; - - /** - * Converts this WebDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams - * @instance - * @returns {Object.} JSON object - */ - WebDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.WebDetectionParams"; - }; - - return WebDetectionParams; - })(); - - v1p4beta1.TextDetectionParams = (function() { - - /** - * Properties of a TextDetectionParams. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ITextDetectionParams - * @property {boolean|null} [enableTextDetectionConfidenceScore] TextDetectionParams enableTextDetectionConfidenceScore - * @property {Array.|null} [advancedOcrOptions] TextDetectionParams advancedOcrOptions - */ - - /** - * Constructs a new TextDetectionParams. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a TextDetectionParams. - * @implements ITextDetectionParams - * @constructor - * @param {google.cloud.vision.v1p4beta1.ITextDetectionParams=} [properties] Properties to set - */ - function TextDetectionParams(properties) { - this.advancedOcrOptions = []; - 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]]; - } - - /** - * TextDetectionParams enableTextDetectionConfidenceScore. - * @member {boolean} enableTextDetectionConfidenceScore - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.enableTextDetectionConfidenceScore = false; - - /** - * TextDetectionParams advancedOcrOptions. - * @member {Array.} advancedOcrOptions - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @instance - */ - TextDetectionParams.prototype.advancedOcrOptions = $util.emptyArray; - - /** - * Creates a new TextDetectionParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p4beta1.ITextDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.TextDetectionParams} TextDetectionParams instance - */ - TextDetectionParams.create = function create(properties) { - return new TextDetectionParams(properties); - }; - - /** - * Encodes the specified TextDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextDetectionParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p4beta1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enableTextDetectionConfidenceScore != null && Object.hasOwnProperty.call(message, "enableTextDetectionConfidenceScore")) - writer.uint32(/* id 9, wireType 0 =*/72).bool(message.enableTextDetectionConfidenceScore); - if (message.advancedOcrOptions != null && message.advancedOcrOptions.length) - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.advancedOcrOptions[i]); - return writer; - }; - - /** - * Encodes the specified TextDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextDetectionParams.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p4beta1.ITextDetectionParams} message TextDetectionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @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.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decode = function decode(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.TextDetectionParams(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 9: { - message.enableTextDetectionConfidenceScore = reader.bool(); - break; - } - case 11: { - if (!(message.advancedOcrOptions && message.advancedOcrOptions.length)) - message.advancedOcrOptions = []; - message.advancedOcrOptions.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TextDetectionParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.TextDetectionParams} TextDetectionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextDetectionParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TextDetectionParams message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TextDetectionParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - if (typeof message.enableTextDetectionConfidenceScore !== "boolean") - return "enableTextDetectionConfidenceScore: boolean expected"; - if (message.advancedOcrOptions != null && message.hasOwnProperty("advancedOcrOptions")) { - if (!Array.isArray(message.advancedOcrOptions)) - return "advancedOcrOptions: array expected"; - for (var i = 0; i < message.advancedOcrOptions.length; ++i) - if (!$util.isString(message.advancedOcrOptions[i])) - return "advancedOcrOptions: string[] expected"; - } - return null; - }; - - /** - * Creates a TextDetectionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.TextDetectionParams} TextDetectionParams - */ - TextDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.TextDetectionParams) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.TextDetectionParams(); - if (object.enableTextDetectionConfidenceScore != null) - message.enableTextDetectionConfidenceScore = Boolean(object.enableTextDetectionConfidenceScore); - if (object.advancedOcrOptions) { - if (!Array.isArray(object.advancedOcrOptions)) - throw TypeError(".google.cloud.vision.v1p4beta1.TextDetectionParams.advancedOcrOptions: array expected"); - message.advancedOcrOptions = []; - for (var i = 0; i < object.advancedOcrOptions.length; ++i) - message.advancedOcrOptions[i] = String(object.advancedOcrOptions[i]); - } - return message; - }; - - /** - * Creates a plain object from a TextDetectionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @static - * @param {google.cloud.vision.v1p4beta1.TextDetectionParams} message TextDetectionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TextDetectionParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.advancedOcrOptions = []; - if (options.defaults) - object.enableTextDetectionConfidenceScore = false; - if (message.enableTextDetectionConfidenceScore != null && message.hasOwnProperty("enableTextDetectionConfidenceScore")) - object.enableTextDetectionConfidenceScore = message.enableTextDetectionConfidenceScore; - if (message.advancedOcrOptions && message.advancedOcrOptions.length) { - object.advancedOcrOptions = []; - for (var j = 0; j < message.advancedOcrOptions.length; ++j) - object.advancedOcrOptions[j] = message.advancedOcrOptions[j]; - } - return object; - }; - - /** - * Converts this TextDetectionParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @instance - * @returns {Object.} JSON object - */ - TextDetectionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextDetectionParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.TextDetectionParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextDetectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.TextDetectionParams"; - }; - - return TextDetectionParams; - })(); - - v1p4beta1.ImageContext = (function() { - - /** - * Properties of an ImageContext. - * @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 - * @property {google.cloud.vision.v1p4beta1.ITextDetectionParams|null} [textDetectionParams] ImageContext textDetectionParams - */ - - /** - * Constructs a new ImageContext. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageContext. - * @implements IImageContext - * @constructor - * @param {google.cloud.vision.v1p4beta1.IImageContext=} [properties] Properties to set - */ - function ImageContext(properties) { - this.languageHints = []; - 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]]; - } - - /** - * 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 - * @instance - */ - ImageContext.prototype.webDetectionParams = null; - - /** - * ImageContext textDetectionParams. - * @member {google.cloud.vision.v1p4beta1.ITextDetectionParams|null|undefined} textDetectionParams - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @instance - */ - ImageContext.prototype.textDetectionParams = null; - - /** - * Creates a new ImageContext instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @static - * @param {google.cloud.vision.v1p4beta1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext instance - */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); - }; - - /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @static - * @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 - */ - ImageContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLongRect != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "cropHintsParams")) - $root.google.cloud.vision.v1p4beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.productSearchParams != null && Object.hasOwnProperty.call(message, "productSearchParams")) - $root.google.cloud.vision.v1p4beta1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.webDetectionParams != null && Object.hasOwnProperty.call(message, "webDetectionParams")) - $root.google.cloud.vision.v1p4beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.faceRecognitionParams != null && Object.hasOwnProperty.call(message, "faceRecognitionParams")) - $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.encode(message.faceRecognitionParams, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.textDetectionParams != null && Object.hasOwnProperty.call(message, "textDetectionParams")) - $root.google.cloud.vision.v1p4beta1.TextDetectionParams.encode(message.textDetectionParams, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - return writer; - }; - - /** - * 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.ImageContext - * @static - * @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 - */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer. - * @function decode - * @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.ImageContext} ImageContext - * @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) { - 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(); - 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()); - break; - } - case 12: { - message.textDetectionParams = $root.google.cloud.vision.v1p4beta1.TextDetectionParams.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageContext message. - * @function verify - * @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 - */ - ImageContext.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.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) { - var error = $root.google.cloud.vision.v1p4beta1.TextDetectionParams.verify(message.textDetectionParams); - if (error) - return "textDetectionParams." + error; - } - return null; - }; - - /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext - */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageContext) - 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); - } - if (object.textDetectionParams != null) { - if (typeof object.textDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.textDetectionParams: object expected"); - message.textDetectionParams = $root.google.cloud.vision.v1p4beta1.TextDetectionParams.fromObject(object.textDetectionParams); - } - return message; - }; - - /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @static - * @param {google.cloud.vision.v1p4beta1.ImageContext} message ImageContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImageContext.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; - object.textDetectionParams = 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]; - } - 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); - if (message.textDetectionParams != null && message.hasOwnProperty("textDetectionParams")) - object.textDetectionParams = $root.google.cloud.vision.v1p4beta1.TextDetectionParams.toObject(message.textDetectionParams, options); - return object; - }; - - /** - * Converts this ImageContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @instance - * @returns {Object.} JSON object - */ - ImageContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ImageContext"; - }; - - return ImageContext; - })(); - - v1p4beta1.AnnotateImageRequest = (function() { - - /** - * Properties of an AnnotateImageRequest. - * @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 - */ - - /** - * Constructs a new AnnotateImageRequest. - * @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 - */ - AnnotateImageRequest.prototype.features = $util.emptyArray; - - /** - * AnnotateImageRequest imageContext. - * @member {google.cloud.vision.v1p4beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.imageContext = null; - - /** - * Creates a new AnnotateImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest instance - */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); - }; - - /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.image != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1p4beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateImageRequest - * @static - * @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 - */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. - * @function decode - * @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.AnnotateImageRequest} AnnotateImageRequest - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateImageRequest message. - * @function verify - * @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 - */ - AnnotateImageRequest.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 (error) - return "imageContext." + error; - } - return null; - }; - - /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest - */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.AnnotateImageRequest} message AnnotateImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateImageRequest.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); - return object; - }; - - /** - * Converts this AnnotateImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AnnotateImageRequest"; - }; - - return AnnotateImageRequest; - })(); - - v1p4beta1.ImageAnnotationContext = (function() { - - /** - * Properties of an ImageAnnotationContext. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IImageAnnotationContext - * @property {string|null} [uri] ImageAnnotationContext uri - * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber - */ - - /** - * Constructs a new ImageAnnotationContext. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageAnnotationContext. - * @implements IImageAnnotationContext - * @constructor - * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext=} [properties] Properties to set - */ - function ImageAnnotationContext(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]]; - } - - /** - * ImageAnnotationContext uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext - * @instance - */ - ImageAnnotationContext.prototype.uri = ""; - - /** - * 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.ImageAnnotationContext - * @static - * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext instance - */ - ImageAnnotationContext.create = function create(properties) { - return new ImageAnnotationContext(properties); - }; - - /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext - * @static - * @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 - */ - ImageAnnotationContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.pageNumber != null && Object.hasOwnProperty.call(message, "pageNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); - return writer; - }; - - /** - * 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.ImageAnnotationContext - * @static - * @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 - */ - ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. - * @function decode - * @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.ImageAnnotationContext} ImageAnnotationContext - * @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) { - 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(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } - case 2: { - message.pageNumber = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImageAnnotationContext message. - * @function verify - * @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 - */ - ImageAnnotationContext.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"; - return null; - }; - - /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext - */ - ImageAnnotationContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext) - 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; - return message; - }; - - /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext - * @static - * @param {google.cloud.vision.v1p4beta1.ImageAnnotationContext} message ImageAnnotationContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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 ImageAnnotationContext to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext - * @instance - * @returns {Object.} JSON object - */ - ImageAnnotationContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImageAnnotationContext - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImageAnnotationContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ImageAnnotationContext"; - }; - - return ImageAnnotationContext; - })(); - - v1p4beta1.AnnotateImageResponse = (function() { - - /** - * Properties of an AnnotateImageResponse. - * @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 - */ - - /** - * Constructs a new AnnotateImageResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.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; - - /** - * 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.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse instance - */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); - }; - - /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.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 && Object.hasOwnProperty.call(message, "safeSearchAnnotation")) - $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && Object.hasOwnProperty.call(message, "imagePropertiesAnnotation")) - $root.google.cloud.vision.v1p4beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && Object.hasOwnProperty.call(message, "cropHintsAnnotation")) - $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && Object.hasOwnProperty.call(message, "fullTextAnnotation")) - $root.google.cloud.vision.v1p4beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && Object.hasOwnProperty.call(message, "webDetection")) - $root.google.cloud.vision.v1p4beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.productSearchResults != null && Object.hasOwnProperty.call(message, "productSearchResults")) - $root.google.cloud.vision.v1p4beta1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.context != null && Object.hasOwnProperty.call(message, "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 AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @static - * @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 - */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. - * @function decode - * @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.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.v1p4beta1.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.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); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p4beta1.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.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 (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]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @static - * @param {google.cloud.vision.v1p4beta1.AnnotateImageResponse} message AnnotateImageResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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 = []; - 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 AnnotateImageResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - * @returns {Object.} JSON object - */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateImageResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateImageResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AnnotateImageResponse"; - }; - - return AnnotateImageResponse; - })(); - - v1p4beta1.BatchAnnotateImagesRequest = (function() { - - /** - * Properties of a BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests - */ - - /** - * Constructs a new BatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest - * @instance - */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; - - /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance - */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest - * @static - * @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 - */ - 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.v1p4beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.BatchAnnotateImagesRequest - * @static - * @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 - */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateImagesRequest message. - * @function verify - * @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 - */ - 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.v1p4beta1.AnnotateImageRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } - return null; - }; - - /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest - */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchAnnotateImagesRequest.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); - } - return object; - }; - - /** - * Converts this BatchAnnotateImagesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest"; - }; - - return BatchAnnotateImagesRequest; - })(); - - v1p4beta1.BatchAnnotateImagesResponse = (function() { - - /** - * Properties of a BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses - */ - - /** - * Constructs a new BatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.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]]; - } - - /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse - * @instance - */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance - */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); - }; - - /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse - * @static - * @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 - */ - 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.v1p4beta1.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.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse - * @static - * @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 - */ - 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.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.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.BatchAnnotateImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.BatchAnnotateImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse - */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.AnnotateImageResponse.toObject(message.responses[j], options); - } - return object; - }; - - /** - * Converts this BatchAnnotateImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse"; - }; - - return BatchAnnotateImagesResponse; - })(); - - v1p4beta1.AnnotateFileRequest = (function() { - - /** - * Properties of an AnnotateFileRequest. - * @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 - */ - - /** - * Constructs a new AnnotateFileRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AnnotateFileRequest. - * @implements IAnnotateFileRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest=} [properties] Properties to set - */ - 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) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1p4beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest - * @instance - */ - AnnotateFileRequest.prototype.inputConfig = null; - - /** - * AnnotateFileRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest - * @instance - */ - AnnotateFileRequest.prototype.features = $util.emptyArray; - - /** - * 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.AnnotateFileRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest instance - */ - AnnotateFileRequest.create = function create(properties) { - return new AnnotateFileRequest(properties); - }; - - /** - * Encodes the specified AnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest - * @static - * @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 - */ - AnnotateFileRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "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 AnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest - * @static - * @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 - */ - 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.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.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.v1p4beta1.AnnotateFileRequest(); - 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: { - 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.v1p4beta1.AnnotateFileRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateFileRequest message. - * @function verify - * @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 - */ - 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.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 "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.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 AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest - */ - AnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest) - 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); - } - 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.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 AnnotateFileRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest - * @static - * @param {google.cloud.vision.v1p4beta1.AnnotateFileRequest} message AnnotateFileRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.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]; - } - return object; - }; - - /** - * Converts this AnnotateFileRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest - * @instance - * @returns {Object.} JSON object - */ - AnnotateFileRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateFileRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateFileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AnnotateFileRequest"; - }; - - return AnnotateFileRequest; - })(); - - v1p4beta1.AnnotateFileResponse = (function() { - - /** - * Properties of an AnnotateFileResponse. - * @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 - */ - - /** - * Constructs a new AnnotateFileResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AnnotateFileResponse. - * @implements IAnnotateFileResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse=} [properties] Properties to set - */ - 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]]; - } - - /** - * 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 - * @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.AnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse instance - */ - AnnotateFileResponse.create = function create(properties) { - return new AnnotateFileResponse(properties); - }; - - /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse - * @static - * @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 - */ - AnnotateFileResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "totalPages")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalPages); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * 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.AnnotateFileResponse - * @static - * @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 - */ - AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. - * @function decode - * @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.AnnotateFileResponse} AnnotateFileResponse - * @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) { - 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(); - 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.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); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateFileResponse message. - * @function verify - * @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 - */ - AnnotateFileResponse.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.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 AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse - */ - AnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse) - 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); - } - 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 AnnotateFileResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p4beta1.AnnotateFileResponse} message AnnotateFileResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AnnotateFileResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - 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 AnnotateFileResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse - * @instance - * @returns {Object.} JSON object - */ - AnnotateFileResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AnnotateFileResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AnnotateFileResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AnnotateFileResponse"; - }; - - return AnnotateFileResponse; - })(); - - v1p4beta1.BatchAnnotateFilesRequest = (function() { - - /** - * Properties of a BatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchAnnotateFilesRequest - * @property {Array.|null} [requests] BatchAnnotateFilesRequest requests - */ - - /** - * Constructs a new BatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchAnnotateFilesRequest. - * @implements IBatchAnnotateFilesRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest=} [properties] Properties to set - */ - function BatchAnnotateFilesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * BatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest - * @instance - */ - BatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; - - /** - * Creates a new BatchAnnotateFilesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest instance - */ - BatchAnnotateFilesRequest.create = function create(properties) { - return new BatchAnnotateFilesRequest(properties); - }; - - /** - * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest - * @static - * @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 - */ - 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.AnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * 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.BatchAnnotateFilesRequest - * @static - * @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 - */ - BatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateFilesRequest message. - * @function verify - * @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 - */ - 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.AnnotateFileRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } - return null; - }; - - /** - * Creates a BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest - */ - BatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest) - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateFilesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} message BatchAnnotateFilesRequest - * @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); - } - return object; - }; - - /** - * Converts this BatchAnnotateFilesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateFilesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateFilesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest"; - }; - - return BatchAnnotateFilesRequest; - })(); - - v1p4beta1.BatchAnnotateFilesResponse = (function() { - - /** - * Properties of a BatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchAnnotateFilesResponse - * @property {Array.|null} [responses] BatchAnnotateFilesResponse responses - */ - - /** - * Constructs a new BatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchAnnotateFilesResponse. - * @implements IBatchAnnotateFilesResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse=} [properties] Properties to set - */ - function BatchAnnotateFilesResponse(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]]; - } - - /** - * BatchAnnotateFilesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @instance - */ - BatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new BatchAnnotateFilesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse instance - */ - BatchAnnotateFilesResponse.create = function create(properties) { - return new BatchAnnotateFilesResponse(properties); - }; - - /** - * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @static - * @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 - */ - 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.AnnotateFileResponse.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.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @static - * @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 - */ - BatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer. - * @function decode - * @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.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse - * @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) { - 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(); - 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())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - BatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchAnnotateFilesResponse message. - * @function verify - * @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 - */ - 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.AnnotateFileResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } - } - 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]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateFilesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} message BatchAnnotateFilesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchAnnotateFilesResponse.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); - } - return object; - }; - - /** - * Converts this BatchAnnotateFilesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @instance - * @returns {Object.} JSON object - */ - BatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchAnnotateFilesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchAnnotateFilesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse"; - }; - - return BatchAnnotateFilesResponse; - })(); - - v1p4beta1.AsyncAnnotateFileRequest = (function() { - - /** - * Properties of an AsyncAnnotateFileRequest. - * @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 - */ - - /** - * Constructs a new AsyncAnnotateFileRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncAnnotateFileRequest. - * @implements IAsyncAnnotateFileRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set - */ - 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]]; - } - - /** - * 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 - * @instance - */ - AsyncAnnotateFileRequest.prototype.outputConfig = null; - - /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance - */ - AsyncAnnotateFileRequest.create = function create(properties) { - return new AsyncAnnotateFileRequest(properties); - }; - - /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @static - * @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 - */ - AsyncAnnotateFileRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "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 && Object.hasOwnProperty.call(message, "imageContext")) - $root.google.cloud.vision.v1p4beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @static - * @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 - */ - AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncAnnotateFileRequest message. - * @function verify - * @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 - */ - AsyncAnnotateFileRequest.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 (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; - } - return null; - }; - - /** - * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest - */ - AsyncAnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest) - 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]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @static - * @param {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncAnnotateFileRequest.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); - } - 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. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncAnnotateFileRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncAnnotateFileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest"; - }; - - return AsyncAnnotateFileRequest; - })(); - - v1p4beta1.AsyncAnnotateFileResponse = (function() { - - /** - * Properties of an AsyncAnnotateFileResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncAnnotateFileResponse - * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig - */ - - /** - * Constructs a new AsyncAnnotateFileResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncAnnotateFileResponse. - * @implements IAsyncAnnotateFileResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - */ - function AsyncAnnotateFileResponse(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]]; - } - - /** - * AsyncAnnotateFileResponse outputConfig. - * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @instance - */ - AsyncAnnotateFileResponse.prototype.outputConfig = null; - - /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance - */ - AsyncAnnotateFileResponse.create = function create(properties) { - return new AsyncAnnotateFileResponse(properties); - }; - - /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @static - * @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 - */ - AsyncAnnotateFileResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, 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. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @static - * @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 - */ - AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. - * @function decode - * @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.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncAnnotateFileResponse message. - * @function verify - * @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 - */ - AsyncAnnotateFileResponse.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; - } - return null; - }; - - /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse - */ - AsyncAnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @static - * @param {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncAnnotateFileResponse.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); - return object; - }; - - /** - * Converts this AsyncAnnotateFileResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncAnnotateFileResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncAnnotateFileResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse"; - }; - - return AsyncAnnotateFileResponse; - })(); - - v1p4beta1.AsyncBatchAnnotateImagesRequest = (function() { - - /** - * Properties of an AsyncBatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncBatchAnnotateImagesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateImagesRequest requests - * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesRequest outputConfig - */ - - /** - * Constructs a new AsyncBatchAnnotateImagesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncBatchAnnotateImagesRequest. - * @implements IAsyncBatchAnnotateImagesRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set - */ - function AsyncBatchAnnotateImagesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * AsyncBatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest - * @instance - */ - AsyncBatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; - - /** - * 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.AsyncBatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest instance - */ - AsyncBatchAnnotateImagesRequest.create = function create(properties) { - return new AsyncBatchAnnotateImagesRequest(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest - * @static - * @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 - */ - AsyncBatchAnnotateImagesRequest.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 && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * 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.AsyncBatchAnnotateImagesRequest - * @static - * @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 - */ - AsyncBatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest - * @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) { - 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(); - 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())); - break; - } - case 2: { - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncBatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncBatchAnnotateImagesRequest message. - * @function verify - * @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 - */ - AsyncBatchAnnotateImagesRequest.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.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 AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest - */ - AsyncBatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest) - 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]); - } - } - 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 an AsyncBatchAnnotateImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncBatchAnnotateImagesRequest.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 (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. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest"; - }; - - return AsyncBatchAnnotateImagesRequest; - })(); - - v1p4beta1.AsyncBatchAnnotateImagesResponse = (function() { - - /** - * Properties of an AsyncBatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncBatchAnnotateImagesResponse - * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesResponse outputConfig - */ - - /** - * Constructs a new AsyncBatchAnnotateImagesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncBatchAnnotateImagesResponse. - * @implements IAsyncBatchAnnotateImagesResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set - */ - function AsyncBatchAnnotateImagesResponse(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]]; - } - - /** - * AsyncBatchAnnotateImagesResponse outputConfig. - * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @instance - */ - AsyncBatchAnnotateImagesResponse.prototype.outputConfig = null; - - /** - * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse instance - */ - AsyncBatchAnnotateImagesResponse.create = function create(properties) { - return new AsyncBatchAnnotateImagesResponse(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @static - * @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 - */ - AsyncBatchAnnotateImagesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) - $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, 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.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @static - * @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 - */ - AsyncBatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer. - * @function decode - * @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.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncBatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncBatchAnnotateImagesResponse message. - * @function verify - * @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 - */ - AsyncBatchAnnotateImagesResponse.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; - } - return null; - }; - - /** - * Creates an AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse - */ - AsyncBatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse) - 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); - } - return message; - }; - - /** - * Creates a plain object from an AsyncBatchAnnotateImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncBatchAnnotateImagesResponse.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); - return object; - }; - - /** - * Converts this AsyncBatchAnnotateImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse"; - }; - - return AsyncBatchAnnotateImagesResponse; - })(); - - v1p4beta1.AsyncBatchAnnotateFilesRequest = (function() { - - /** - * Properties of an AsyncBatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncBatchAnnotateFilesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests - */ - - /** - * Constructs a new AsyncBatchAnnotateFilesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesRequest. - * @implements IAsyncBatchAnnotateFilesRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - */ - function AsyncBatchAnnotateFilesRequest(properties) { - this.requests = []; - 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]]; - } - - /** - * AsyncBatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @instance - */ - AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; - - /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance - */ - AsyncBatchAnnotateFilesRequest.create = function create(properties) { - return new AsyncBatchAnnotateFilesRequest(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @static - * @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 - */ - 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.v1p4beta1.AsyncAnnotateFileRequest.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. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @static - * @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 - */ - AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. - * @function decode - * @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.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest - * @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) { - 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(); - 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())); - 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.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncBatchAnnotateFilesRequest message. - * @function verify - * @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 - */ - 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.v1p4beta1.AsyncAnnotateFileRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } - return null; - }; - - /** - * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest - */ - AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest) - return object; - 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 an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.v1p4beta1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); - } - return object; - }; - - /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateFilesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest"; - }; - - return AsyncBatchAnnotateFilesRequest; - })(); - - v1p4beta1.AsyncBatchAnnotateFilesResponse = (function() { - - /** - * Properties of an AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncBatchAnnotateFilesResponse - * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses - */ - - /** - * Constructs a new AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesResponse. - * @implements IAsyncBatchAnnotateFilesResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @instance - */ - AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance - */ - AsyncBatchAnnotateFilesResponse.create = function create(properties) { - return new AsyncBatchAnnotateFilesResponse(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @static - * @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 - */ - 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.v1p4beta1.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.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @static - * @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 - */ - 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.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.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - 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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse - */ - AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse) - return object; - 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 an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); - } - return object; - }; - - /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AsyncBatchAnnotateFilesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AsyncBatchAnnotateFilesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse"; - }; - - return AsyncBatchAnnotateFilesResponse; - })(); - - v1p4beta1.InputConfig = (function() { - - /** - * Properties of an InputConfig. - * @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 - */ - - /** - * Constructs a new InputConfig. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig - * @constructor - * @param {google.cloud.vision.v1p4beta1.IInputConfig=} [properties] Properties to set - */ - function InputConfig(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]]; - } - - /** - * 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 - * @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 && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.vision.v1p4beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); - if (message.content != null && Object.hasOwnProperty.call(message, "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 >= 0) - 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; - }; - - /** - * Converts this InputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @instance - * @returns {Object.} JSON object - */ - InputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.InputConfig"; - }; - - 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]]; - } - - /** - * OutputConfig gcsDestination. - * @member {google.cloud.vision.v1p4beta1.IGcsDestination|null|undefined} gcsDestination - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @instance - */ - OutputConfig.prototype.gcsDestination = null; - - /** - * OutputConfig batchSize. - * @member {number} batchSize - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @instance - */ - OutputConfig.prototype.batchSize = 0; - - /** - * Creates a new OutputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig instance - */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); - }; - - /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @static - * @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 - */ - OutputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) - $root.google.cloud.vision.v1p4beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.batchSize != null && Object.hasOwnProperty.call(message, "batchSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); - return writer; - }; - - /** - * 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.OutputConfig - * @static - * @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 - */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OutputConfig message from the specified reader or buffer. - * @function decode - * @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.OutputConfig} OutputConfig - * @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) { - 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(); - 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()); - break; - } - case 2: { - message.batchSize = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OutputConfig message. - * @function verify - * @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 - */ - OutputConfig.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 (error) - return "gcsDestination." + 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. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig - */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.OutputConfig) - 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); - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.OutputConfig} message OutputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OutputConfig.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.v1p4beta1.GcsDestination.toObject(message.gcsDestination, options); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - object.batchSize = message.batchSize; - return object; - }; - - /** - * Converts this OutputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @instance - * @returns {Object.} JSON object - */ - OutputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OutputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.OutputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.OutputConfig"; - }; - - return OutputConfig; - })(); - - v1p4beta1.GcsSource = (function() { - - /** - * Properties of a GcsSource. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri - */ - - /** - * Constructs a new GcsSource. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource - * @constructor - * @param {google.cloud.vision.v1p4beta1.IGcsSource=} [properties] Properties to set - */ - function GcsSource(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]]; - } - - /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p4beta1.GcsSource - * @instance - */ - GcsSource.prototype.uri = ""; - - /** - * Creates a new GcsSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.GcsSource - * @static - * @param {google.cloud.vision.v1p4beta1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource instance - */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); - }; - - /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.GcsSource - * @static - * @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 - */ - GcsSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - return writer; - }; - - /** - * 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.GcsSource - * @static - * @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 - */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer. - * @function decode - * @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.GcsSource} GcsSource - * @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) { - 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(); - 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; - }; - - /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GcsSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GcsSource message. - * @function verify - * @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 - */ - GcsSource.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 GcsSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.GcsSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource - */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.GcsSource) - return object; - 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 GcsSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.GcsSource - * @static - * @param {google.cloud.vision.v1p4beta1.GcsSource} message GcsSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GcsSource.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; - }; - - /** - * Converts this GcsSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.GcsSource - * @instance - * @returns {Object.} JSON object - */ - GcsSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GcsSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.GcsSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.GcsSource"; - }; - - return GcsSource; - })(); - - v1p4beta1.GcsDestination = (function() { - - /** - * Properties of a GcsDestination. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri - */ - - /** - * Constructs a new GcsDestination. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a GcsDestination. - * @implements IGcsDestination - * @constructor - * @param {google.cloud.vision.v1p4beta1.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]]; - } - - /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p4beta1.GcsDestination - * @instance - */ - GcsDestination.prototype.uri = ""; - - /** - * Creates a new GcsDestination instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.GcsDestination - * @static - * @param {google.cloud.vision.v1p4beta1.IGcsDestination=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination instance - */ - GcsDestination.create = function create(properties) { - return new GcsDestination(properties); - }; - - /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.GcsDestination - * @static - * @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 - */ - GcsDestination.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - return writer; - }; - - /** - * 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.GcsDestination - * @static - * @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 - */ - GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GcsDestination message from the specified reader or buffer. - * @function decode - * @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.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.v1p4beta1.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; - }; - - /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GcsDestination - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - GcsDestination.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GcsDestination message. - * @function verify - * @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 - */ - 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 GcsDestination message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.GcsDestination - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination - */ - GcsDestination.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.GcsDestination) - return object; - 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 GcsDestination message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.GcsDestination - * @static - * @param {google.cloud.vision.v1p4beta1.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; - }; - - /** - * Converts this GcsDestination to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.GcsDestination - * @instance - * @returns {Object.} JSON object - */ - GcsDestination.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GcsDestination - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.GcsDestination - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GcsDestination.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.GcsDestination"; - }; - - return GcsDestination; - })(); - - v1p4beta1.OperationMetadata = (function() { - - /** - * Properties of an OperationMetadata. - * @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 - */ - - /** - * Constructs a new OperationMetadata. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata - * @constructor - * @param {google.cloud.vision.v1p4beta1.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]]; - } - - /** - * 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 - * @instance - */ - OperationMetadata.prototype.updateTime = null; - - /** - * Creates a new OperationMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @static - * @param {google.cloud.vision.v1p4beta1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata instance - */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); - }; - - /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @static - * @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 - */ - OperationMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * 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.OperationMetadata - * @static - * @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 - */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer. - * @function decode - * @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.OperationMetadata} OperationMetadata - * @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) { - 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(); - 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()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @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 - */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationMetadata message. - * @function verify - * @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 - */ - OperationMetadata.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 (error) - return "updateTime." + error; - } - return null; - }; - - /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata - */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.OperationMetadata) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.OperationMetadata(); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - 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 an OperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @static - * @param {google.cloud.vision.v1p4beta1.OperationMetadata} message OperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationMetadata.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] === undefined ? message.state : $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 OperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @instance - * @returns {Object.} JSON object - */ - OperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationMetadata - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.OperationMetadata"; - }; - - /** - * State enum. - * @name google.cloud.vision.v1p4beta1.OperationMetadata.State - * @enum {number} - * @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() { - - /** - * Properties of a ProductSearchParams. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IProductSearchParams - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] ProductSearchParams boundingPoly - * @property {string|null} [productSet] ProductSearchParams productSet - * @property {Array.|null} [productCategories] ProductSearchParams productCategories - * @property {string|null} [filter] ProductSearchParams filter - */ - - /** - * Constructs a new ProductSearchParams. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ProductSearchParams. - * @implements IProductSearchParams - * @constructor - * @param {google.cloud.vision.v1p4beta1.IProductSearchParams=} [properties] Properties to set - */ - function ProductSearchParams(properties) { - this.productCategories = []; - 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]]; - } - - /** - * ProductSearchParams boundingPoly. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.boundingPoly = null; - - /** - * ProductSearchParams productSet. - * @member {string} productSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.productSet = ""; - - /** - * ProductSearchParams productCategories. - * @member {Array.} productCategories - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.productCategories = $util.emptyArray; - - /** - * ProductSearchParams filter. - * @member {string} filter - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @instance - */ - ProductSearchParams.prototype.filter = ""; - - /** - * Creates a new ProductSearchParams instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSearchParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ProductSearchParams} ProductSearchParams instance - */ - ProductSearchParams.create = function create(properties) { - return new ProductSearchParams(properties); - }; - - /** - * Encodes the specified ProductSearchParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchParams.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSearchParams} message ProductSearchParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.productSet); - if (message.productCategories != null && message.productCategories.length) - for (var i = 0; i < message.productCategories.length; ++i) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.productCategories[i]); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.filter); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSearchParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchParams.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSearchParams} message ProductSearchParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @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.ProductSearchParams} ProductSearchParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchParams.decode = function decode(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.ProductSearchParams(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 9: { - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 6: { - message.productSet = reader.string(); - break; - } - case 7: { - if (!(message.productCategories && message.productCategories.length)) - message.productCategories = []; - message.productCategories.push(reader.string()); - break; - } - case 8: { - message.filter = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSearchParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ProductSearchParams} ProductSearchParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSearchParams message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSearchParams.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.productSet != null && message.hasOwnProperty("productSet")) - if (!$util.isString(message.productSet)) - return "productSet: string expected"; - if (message.productCategories != null && message.hasOwnProperty("productCategories")) { - if (!Array.isArray(message.productCategories)) - return "productCategories: array expected"; - for (var i = 0; i < message.productCategories.length; ++i) - if (!$util.isString(message.productCategories[i])) - return "productCategories: string[] expected"; - } - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - return null; - }; - - /** - * Creates a ProductSearchParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ProductSearchParams} ProductSearchParams - */ - ProductSearchParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ProductSearchParams) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ProductSearchParams(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchParams.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.productSet != null) - message.productSet = String(object.productSet); - if (object.productCategories) { - if (!Array.isArray(object.productCategories)) - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchParams.productCategories: array expected"); - message.productCategories = []; - for (var i = 0; i < object.productCategories.length; ++i) - message.productCategories[i] = String(object.productCategories[i]); - } - if (object.filter != null) - message.filter = String(object.filter); - return message; - }; - - /** - * Creates a plain object from a ProductSearchParams message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchParams} message ProductSearchParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSearchParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productCategories = []; - if (options.defaults) { - object.productSet = ""; - object.filter = ""; - object.boundingPoly = null; - } - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = message.productSet; - if (message.productCategories && message.productCategories.length) { - object.productCategories = []; - for (var j = 0; j < message.productCategories.length; ++j) - object.productCategories[j] = message.productCategories[j]; - } - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); - return object; - }; - - /** - * Converts this ProductSearchParams to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @instance - * @returns {Object.} JSON object - */ - ProductSearchParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSearchParams - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ProductSearchParams - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSearchParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ProductSearchParams"; - }; - - return ProductSearchParams; - })(); - - v1p4beta1.ProductSearchResults = (function() { - - /** - * Properties of a ProductSearchResults. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IProductSearchResults - * @property {google.protobuf.ITimestamp|null} [indexTime] ProductSearchResults indexTime - * @property {Array.|null} [results] ProductSearchResults results - * @property {Array.|null} [productGroupedResults] ProductSearchResults productGroupedResults - */ - - /** - * Constructs a new ProductSearchResults. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ProductSearchResults. - * @implements IProductSearchResults - * @constructor - * @param {google.cloud.vision.v1p4beta1.IProductSearchResults=} [properties] Properties to set - */ - function ProductSearchResults(properties) { - this.results = []; - this.productGroupedResults = []; - 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]]; - } - - /** - * ProductSearchResults indexTime. - * @member {google.protobuf.ITimestamp|null|undefined} indexTime - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.indexTime = null; - - /** - * ProductSearchResults results. - * @member {Array.} results - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.results = $util.emptyArray; - - /** - * ProductSearchResults productGroupedResults. - * @member {Array.} productGroupedResults - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @instance - */ - ProductSearchResults.prototype.productGroupedResults = $util.emptyArray; - - /** - * Creates a new ProductSearchResults instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSearchResults=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults} ProductSearchResults instance - */ - ProductSearchResults.create = function create(properties) { - return new ProductSearchResults(properties); - }; - - /** - * Encodes the specified ProductSearchResults message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSearchResults} message ProductSearchResults message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchResults.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.indexTime != null && Object.hasOwnProperty.call(message, "indexTime")) - $root.google.protobuf.Timestamp.encode(message.indexTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.encode(message.results[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.productGroupedResults != null && message.productGroupedResults.length) - for (var i = 0; i < message.productGroupedResults.length; ++i) - $root.google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.encode(message.productGroupedResults[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSearchResults message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSearchResults} message ProductSearchResults message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSearchResults.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @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.ProductSearchResults} ProductSearchResults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchResults.decode = function decode(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.ProductSearchResults(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - message.indexTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.productGroupedResults && message.productGroupedResults.length)) - message.productGroupedResults = []; - message.productGroupedResults.push($root.google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSearchResults message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults} ProductSearchResults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSearchResults.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSearchResults message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSearchResults.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.indexTime); - if (error) - return "indexTime." + error; - } - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.productGroupedResults != null && message.hasOwnProperty("productGroupedResults")) { - if (!Array.isArray(message.productGroupedResults)) - return "productGroupedResults: array expected"; - for (var i = 0; i < message.productGroupedResults.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.verify(message.productGroupedResults[i]); - if (error) - return "productGroupedResults." + error; - } - } - return null; - }; - - /** - * Creates a ProductSearchResults message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults} ProductSearchResults - */ - ProductSearchResults.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ProductSearchResults) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ProductSearchResults(); - if (object.indexTime != null) { - if (typeof object.indexTime !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.indexTime: object expected"); - message.indexTime = $root.google.protobuf.Timestamp.fromObject(object.indexTime); - } - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.results: object expected"); - message.results[i] = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.fromObject(object.results[i]); - } - } - if (object.productGroupedResults) { - if (!Array.isArray(object.productGroupedResults)) - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.productGroupedResults: array expected"); - message.productGroupedResults = []; - for (var i = 0; i < object.productGroupedResults.length; ++i) { - if (typeof object.productGroupedResults[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.productGroupedResults: object expected"); - message.productGroupedResults[i] = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.fromObject(object.productGroupedResults[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ProductSearchResults message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults} message ProductSearchResults - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSearchResults.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.productGroupedResults = []; - } - if (options.defaults) - object.indexTime = null; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) - object.indexTime = $root.google.protobuf.Timestamp.toObject(message.indexTime, options); - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.toObject(message.results[j], options); - } - if (message.productGroupedResults && message.productGroupedResults.length) { - object.productGroupedResults = []; - for (var j = 0; j < message.productGroupedResults.length; ++j) - object.productGroupedResults[j] = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.toObject(message.productGroupedResults[j], options); - } - return object; - }; - - /** - * Converts this ProductSearchResults to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @instance - * @returns {Object.} JSON object - */ - ProductSearchResults.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSearchResults - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSearchResults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ProductSearchResults"; - }; - - ProductSearchResults.Result = (function() { - - /** - * Properties of a Result. - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @interface IResult - * @property {google.cloud.vision.v1p4beta1.IProduct|null} [product] Result product - * @property {number|null} [score] Result score - * @property {string|null} [image] Result image - */ - - /** - * Constructs a new Result. - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @classdesc Represents a Result. - * @implements IResult - * @constructor - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IResult=} [properties] Properties to set - */ - function Result(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]]; - } - - /** - * Result product. - * @member {google.cloud.vision.v1p4beta1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @instance - */ - Result.prototype.product = null; - - /** - * Result score. - * @member {number} score - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @instance - */ - Result.prototype.score = 0; - - /** - * Result image. - * @member {string} image - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @instance - */ - Result.prototype.image = ""; - - /** - * Creates a new Result instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IResult=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.Result} Result instance - */ - Result.create = function create(properties) { - return new Result(properties); - }; - - /** - * Encodes the specified Result message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.Result.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IResult} message Result message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Result.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1p4beta1.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.image != null && Object.hasOwnProperty.call(message, "image")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.image); - return writer; - }; - - /** - * Encodes the specified Result message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.Result.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IResult} message Result message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Result.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Result message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @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.ProductSearchResults.Result} Result - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Result.decode = function decode(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.ProductSearchResults.Result(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.product = $root.google.cloud.vision.v1p4beta1.Product.decode(reader, reader.uint32()); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.image = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Result message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.Result} Result - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Result.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Result message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Result.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1p4beta1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.image != null && message.hasOwnProperty("image")) - if (!$util.isString(message.image)) - return "image: string expected"; - return null; - }; - - /** - * Creates a Result message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.Result} Result - */ - Result.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.Result.product: object expected"); - message.product = $root.google.cloud.vision.v1p4beta1.Product.fromObject(object.product); - } - if (object.score != null) - message.score = Number(object.score); - if (object.image != null) - message.image = String(object.image); - return message; - }; - - /** - * Creates a plain object from a Result message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.Result} message Result - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Result.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.score = 0; - object.image = ""; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1p4beta1.Product.toObject(message.product, options); - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.image != null && message.hasOwnProperty("image")) - object.image = message.image; - return object; - }; - - /** - * Converts this Result to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @instance - * @returns {Object.} JSON object - */ - Result.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Result - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.Result - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Result.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ProductSearchResults.Result"; - }; - - return Result; - })(); - - ProductSearchResults.ObjectAnnotation = (function() { - - /** - * Properties of an ObjectAnnotation. - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @interface IObjectAnnotation - * @property {string|null} [mid] ObjectAnnotation mid - * @property {string|null} [languageCode] ObjectAnnotation languageCode - * @property {string|null} [name] ObjectAnnotation name - * @property {number|null} [score] ObjectAnnotation score - */ - - /** - * Constructs a new ObjectAnnotation. - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @classdesc Represents an ObjectAnnotation. - * @implements IObjectAnnotation - * @constructor - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation=} [properties] Properties to set - */ - function ObjectAnnotation(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]]; - } - - /** - * ObjectAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.mid = ""; - - /** - * ObjectAnnotation languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.languageCode = ""; - - /** - * ObjectAnnotation name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.name = ""; - - /** - * ObjectAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @instance - */ - ObjectAnnotation.prototype.score = 0; - - /** - * Creates a new ObjectAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation instance - */ - ObjectAnnotation.create = function create(properties) { - return new ObjectAnnotation(properties); - }; - - /** - * Encodes the specified ObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation} message ObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ObjectAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && Object.hasOwnProperty.call(message, "mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - return writer; - }; - - /** - * Encodes the specified ObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IObjectAnnotation} message ObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @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.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ObjectAnnotation.decode = function decode(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.ProductSearchResults.ObjectAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - 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; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ObjectAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ObjectAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ObjectAnnotation.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"; - return null; - }; - - /** - * Creates an ObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation} ObjectAnnotation - */ - ObjectAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation(); - 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); - return message; - }; - - /** - * Creates a plain object from an ObjectAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation} message ObjectAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ObjectAnnotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.mid = ""; - object.languageCode = ""; - object.name = ""; - object.score = 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; - return object; - }; - - /** - * Converts this ObjectAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @instance - * @returns {Object.} JSON object - */ - ObjectAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ObjectAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ObjectAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation"; - }; - - return ObjectAnnotation; - })(); - - ProductSearchResults.GroupedResult = (function() { - - /** - * Properties of a GroupedResult. - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @interface IGroupedResult - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] GroupedResult boundingPoly - * @property {Array.|null} [results] GroupedResult results - * @property {Array.|null} [objectAnnotations] GroupedResult objectAnnotations - */ - - /** - * Constructs a new GroupedResult. - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults - * @classdesc Represents a GroupedResult. - * @implements IGroupedResult - * @constructor - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult=} [properties] Properties to set - */ - function GroupedResult(properties) { - this.results = []; - this.objectAnnotations = []; - 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]]; - } - - /** - * GroupedResult boundingPoly. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.boundingPoly = null; - - /** - * GroupedResult results. - * @member {Array.} results - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.results = $util.emptyArray; - - /** - * GroupedResult objectAnnotations. - * @member {Array.} objectAnnotations - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @instance - */ - GroupedResult.prototype.objectAnnotations = $util.emptyArray; - - /** - * Creates a new GroupedResult instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult} GroupedResult instance - */ - GroupedResult.create = function create(properties) { - return new GroupedResult(properties); - }; - - /** - * Encodes the specified GroupedResult message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult} message GroupedResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GroupedResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.boundingPoly != null && Object.hasOwnProperty.call(message, "boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.encode(message.results[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.objectAnnotations != null && message.objectAnnotations.length) - for (var i = 0; i < message.objectAnnotations.length; ++i) - $root.google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.encode(message.objectAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GroupedResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.IGroupedResult} message GroupedResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GroupedResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GroupedResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @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.ProductSearchResults.GroupedResult} GroupedResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GroupedResult.decode = function decode(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.ProductSearchResults.GroupedResult(); - 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()); - break; - } - case 2: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.objectAnnotations && message.objectAnnotations.length)) - message.objectAnnotations = []; - message.objectAnnotations.push($root.google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GroupedResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult} GroupedResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GroupedResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GroupedResult message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GroupedResult.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.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.objectAnnotations != null && message.hasOwnProperty("objectAnnotations")) { - if (!Array.isArray(message.objectAnnotations)) - return "objectAnnotations: array expected"; - for (var i = 0; i < message.objectAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.verify(message.objectAnnotations[i]); - if (error) - return "objectAnnotations." + error; - } - } - return null; - }; - - /** - * Creates a GroupedResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult} GroupedResult - */ - GroupedResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.results: object expected"); - message.results[i] = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.fromObject(object.results[i]); - } - } - if (object.objectAnnotations) { - if (!Array.isArray(object.objectAnnotations)) - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.objectAnnotations: array expected"); - message.objectAnnotations = []; - for (var i = 0; i < object.objectAnnotations.length; ++i) { - if (typeof object.objectAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult.objectAnnotations: object expected"); - message.objectAnnotations[i] = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.fromObject(object.objectAnnotations[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GroupedResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult} message GroupedResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GroupedResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.objectAnnotations = []; - } - if (options.defaults) - object.boundingPoly = null; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.Result.toObject(message.results[j], options); - } - if (message.objectAnnotations && message.objectAnnotations.length) { - object.objectAnnotations = []; - for (var j = 0; j < message.objectAnnotations.length; ++j) - object.objectAnnotations[j] = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation.toObject(message.objectAnnotations[j], options); - } - return object; - }; - - /** - * Converts this GroupedResult to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @instance - * @returns {Object.} JSON object - */ - GroupedResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GroupedResult - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GroupedResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult"; - }; - - return GroupedResult; - })(); - - return ProductSearchResults; - })(); - - v1p4beta1.ProductSearch = (function() { - - /** - * Constructs a new ProductSearch service. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ProductSearch - * @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 ProductSearch(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ProductSearch.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ProductSearch; - - /** - * Creates new ProductSearch service using the specified rpc implementation. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @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 {ProductSearch} RPC service. Useful where requests and/or responses are streamed. - */ - ProductSearch.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|createProductSet}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef CreateProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ProductSet} [response] ProductSet - */ - - /** - * Calls CreateProductSet. - * @function createProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.ICreateProductSetRequest} request CreateProductSetRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.CreateProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createProductSet = function createProductSet(request, callback) { - return this.rpcCall(createProductSet, $root.google.cloud.vision.v1p4beta1.CreateProductSetRequest, $root.google.cloud.vision.v1p4beta1.ProductSet, request, callback); - }, "name", { value: "CreateProductSet" }); - - /** - * Calls CreateProductSet. - * @function createProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.ICreateProductSetRequest} request CreateProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|listProductSets}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef ListProductSetsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ListProductSetsResponse} [response] ListProductSetsResponse - */ - - /** - * Calls ListProductSets. - * @function listProductSets - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IListProductSetsRequest} request ListProductSetsRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.ListProductSetsCallback} callback Node-style callback called with the error, if any, and ListProductSetsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProductSets = function listProductSets(request, callback) { - return this.rpcCall(listProductSets, $root.google.cloud.vision.v1p4beta1.ListProductSetsRequest, $root.google.cloud.vision.v1p4beta1.ListProductSetsResponse, request, callback); - }, "name", { value: "ListProductSets" }); - - /** - * Calls ListProductSets. - * @function listProductSets - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IListProductSetsRequest} request ListProductSetsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|getProductSet}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef GetProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ProductSet} [response] ProductSet - */ - - /** - * Calls GetProductSet. - * @function getProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IGetProductSetRequest} request GetProductSetRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.GetProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getProductSet = function getProductSet(request, callback) { - return this.rpcCall(getProductSet, $root.google.cloud.vision.v1p4beta1.GetProductSetRequest, $root.google.cloud.vision.v1p4beta1.ProductSet, request, callback); - }, "name", { value: "GetProductSet" }); - - /** - * Calls GetProductSet. - * @function getProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IGetProductSetRequest} request GetProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|updateProductSet}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef UpdateProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ProductSet} [response] ProductSet - */ - - /** - * Calls UpdateProductSet. - * @function updateProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IUpdateProductSetRequest} request UpdateProductSetRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.UpdateProductSetCallback} callback Node-style callback called with the error, if any, and ProductSet - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.updateProductSet = function updateProductSet(request, callback) { - return this.rpcCall(updateProductSet, $root.google.cloud.vision.v1p4beta1.UpdateProductSetRequest, $root.google.cloud.vision.v1p4beta1.ProductSet, request, callback); - }, "name", { value: "UpdateProductSet" }); - - /** - * Calls UpdateProductSet. - * @function updateProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IUpdateProductSetRequest} request UpdateProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|deleteProductSet}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef DeleteProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProductSet. - * @function deleteProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IDeleteProductSetRequest} request DeleteProductSetRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.DeleteProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteProductSet = function deleteProductSet(request, callback) { - return this.rpcCall(deleteProductSet, $root.google.cloud.vision.v1p4beta1.DeleteProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProductSet" }); - - /** - * Calls DeleteProductSet. - * @function deleteProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IDeleteProductSetRequest} request DeleteProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|createProduct}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef CreateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.Product} [response] Product - */ - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.ICreateProductRequest} request CreateProductRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.CreateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createProduct = function createProduct(request, callback) { - return this.rpcCall(createProduct, $root.google.cloud.vision.v1p4beta1.CreateProductRequest, $root.google.cloud.vision.v1p4beta1.Product, request, callback); - }, "name", { value: "CreateProduct" }); - - /** - * Calls CreateProduct. - * @function createProduct - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.ICreateProductRequest} request CreateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|listProducts}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef ListProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ListProductsResponse} [response] ListProductsResponse - */ - - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IListProductsRequest} request ListProductsRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.ListProductsCallback} callback Node-style callback called with the error, if any, and ListProductsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProducts = function listProducts(request, callback) { - return this.rpcCall(listProducts, $root.google.cloud.vision.v1p4beta1.ListProductsRequest, $root.google.cloud.vision.v1p4beta1.ListProductsResponse, request, callback); - }, "name", { value: "ListProducts" }); - - /** - * Calls ListProducts. - * @function listProducts - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IListProductsRequest} request ListProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|getProduct}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef GetProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.Product} [response] Product - */ - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IGetProductRequest} request GetProductRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.GetProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getProduct = function getProduct(request, callback) { - return this.rpcCall(getProduct, $root.google.cloud.vision.v1p4beta1.GetProductRequest, $root.google.cloud.vision.v1p4beta1.Product, request, callback); - }, "name", { value: "GetProduct" }); - - /** - * Calls GetProduct. - * @function getProduct - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IGetProductRequest} request GetProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|updateProduct}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef UpdateProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.Product} [response] Product - */ - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.UpdateProductCallback} callback Node-style callback called with the error, if any, and Product - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.updateProduct = function updateProduct(request, callback) { - return this.rpcCall(updateProduct, $root.google.cloud.vision.v1p4beta1.UpdateProductRequest, $root.google.cloud.vision.v1p4beta1.Product, request, callback); - }, "name", { value: "UpdateProduct" }); - - /** - * Calls UpdateProduct. - * @function updateProduct - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IUpdateProductRequest} request UpdateProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|deleteProduct}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef DeleteProductCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.DeleteProductCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteProduct = function deleteProduct(request, callback) { - return this.rpcCall(deleteProduct, $root.google.cloud.vision.v1p4beta1.DeleteProductRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteProduct" }); - - /** - * Calls DeleteProduct. - * @function deleteProduct - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IDeleteProductRequest} request DeleteProductRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|createReferenceImage}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef CreateReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ReferenceImage} [response] ReferenceImage - */ - - /** - * Calls CreateReferenceImage. - * @function createReferenceImage - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest} request CreateReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.CreateReferenceImageCallback} callback Node-style callback called with the error, if any, and ReferenceImage - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.createReferenceImage = function createReferenceImage(request, callback) { - return this.rpcCall(createReferenceImage, $root.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest, $root.google.cloud.vision.v1p4beta1.ReferenceImage, request, callback); - }, "name", { value: "CreateReferenceImage" }); - - /** - * Calls CreateReferenceImage. - * @function createReferenceImage - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest} request CreateReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|deleteReferenceImage}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef DeleteReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteReferenceImage. - * @function deleteReferenceImage - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest} request DeleteReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.DeleteReferenceImageCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.deleteReferenceImage = function deleteReferenceImage(request, callback) { - return this.rpcCall(deleteReferenceImage, $root.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteReferenceImage" }); - - /** - * Calls DeleteReferenceImage. - * @function deleteReferenceImage - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest} request DeleteReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|listReferenceImages}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef ListReferenceImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ListReferenceImagesResponse} [response] ListReferenceImagesResponse - */ - - /** - * Calls ListReferenceImages. - * @function listReferenceImages - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesRequest} request ListReferenceImagesRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.ListReferenceImagesCallback} callback Node-style callback called with the error, if any, and ListReferenceImagesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listReferenceImages = function listReferenceImages(request, callback) { - return this.rpcCall(listReferenceImages, $root.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest, $root.google.cloud.vision.v1p4beta1.ListReferenceImagesResponse, request, callback); - }, "name", { value: "ListReferenceImages" }); - - /** - * Calls ListReferenceImages. - * @function listReferenceImages - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesRequest} request ListReferenceImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|getReferenceImage}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef GetReferenceImageCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ReferenceImage} [response] ReferenceImage - */ - - /** - * Calls GetReferenceImage. - * @function getReferenceImage - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IGetReferenceImageRequest} request GetReferenceImageRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.GetReferenceImageCallback} callback Node-style callback called with the error, if any, and ReferenceImage - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.getReferenceImage = function getReferenceImage(request, callback) { - return this.rpcCall(getReferenceImage, $root.google.cloud.vision.v1p4beta1.GetReferenceImageRequest, $root.google.cloud.vision.v1p4beta1.ReferenceImage, request, callback); - }, "name", { value: "GetReferenceImage" }); - - /** - * Calls GetReferenceImage. - * @function getReferenceImage - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IGetReferenceImageRequest} request GetReferenceImageRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|addProductToProductSet}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef AddProductToProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls AddProductToProductSet. - * @function addProductToProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest} request AddProductToProductSetRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.AddProductToProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.addProductToProductSet = function addProductToProductSet(request, callback) { - return this.rpcCall(addProductToProductSet, $root.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "AddProductToProductSet" }); - - /** - * Calls AddProductToProductSet. - * @function addProductToProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest} request AddProductToProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|removeProductFromProductSet}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef RemoveProductFromProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls RemoveProductFromProductSet. - * @function removeProductFromProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest} request RemoveProductFromProductSetRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.RemoveProductFromProductSetCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.removeProductFromProductSet = function removeProductFromProductSet(request, callback) { - return this.rpcCall(removeProductFromProductSet, $root.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "RemoveProductFromProductSet" }); - - /** - * Calls RemoveProductFromProductSet. - * @function removeProductFromProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest} request RemoveProductFromProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|listProductsInProductSet}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef ListProductsInProductSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse} [response] ListProductsInProductSetResponse - */ - - /** - * Calls ListProductsInProductSet. - * @function listProductsInProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest} request ListProductsInProductSetRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.ListProductsInProductSetCallback} callback Node-style callback called with the error, if any, and ListProductsInProductSetResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.listProductsInProductSet = function listProductsInProductSet(request, callback) { - return this.rpcCall(listProductsInProductSet, $root.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest, $root.google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse, request, callback); - }, "name", { value: "ListProductsInProductSet" }); - - /** - * Calls ListProductsInProductSet. - * @function listProductsInProductSet - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest} request ListProductsInProductSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|importProductSets}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef ImportProductSetsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls ImportProductSets. - * @function importProductSets - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsRequest} request ImportProductSetsRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.ImportProductSetsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.importProductSets = function importProductSets(request, callback) { - return this.rpcCall(importProductSets, $root.google.cloud.vision.v1p4beta1.ImportProductSetsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "ImportProductSets" }); - - /** - * Calls ImportProductSets. - * @function importProductSets - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsRequest} request ImportProductSetsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ProductSearch|purgeProducts}. - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @typedef PurgeProductsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls PurgeProducts. - * @function purgeProducts - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IPurgeProductsRequest} request PurgeProductsRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ProductSearch.PurgeProductsCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ProductSearch.prototype.purgeProducts = function purgeProducts(request, callback) { - return this.rpcCall(purgeProducts, $root.google.cloud.vision.v1p4beta1.PurgeProductsRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "PurgeProducts" }); - - /** - * Calls PurgeProducts. - * @function purgeProducts - * @memberof google.cloud.vision.v1p4beta1.ProductSearch - * @instance - * @param {google.cloud.vision.v1p4beta1.IPurgeProductsRequest} request PurgeProductsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ProductSearch; - })(); - - v1p4beta1.Product = (function() { - - /** - * Properties of a Product. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IProduct - * @property {string|null} [name] Product name - * @property {string|null} [displayName] Product displayName - * @property {string|null} [description] Product description - * @property {string|null} [productCategory] Product productCategory - * @property {Array.|null} [productLabels] Product productLabels - */ - - /** - * Constructs a new Product. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Product. - * @implements IProduct - * @constructor - * @param {google.cloud.vision.v1p4beta1.IProduct=} [properties] Properties to set - */ - function Product(properties) { - this.productLabels = []; - 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]]; - } - - /** - * Product name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.Product - * @instance - */ - Product.prototype.name = ""; - - /** - * Product displayName. - * @member {string} displayName - * @memberof google.cloud.vision.v1p4beta1.Product - * @instance - */ - Product.prototype.displayName = ""; - - /** - * Product description. - * @member {string} description - * @memberof google.cloud.vision.v1p4beta1.Product - * @instance - */ - Product.prototype.description = ""; - - /** - * Product productCategory. - * @member {string} productCategory - * @memberof google.cloud.vision.v1p4beta1.Product - * @instance - */ - Product.prototype.productCategory = ""; - - /** - * Product productLabels. - * @member {Array.} productLabels - * @memberof google.cloud.vision.v1p4beta1.Product - * @instance - */ - Product.prototype.productLabels = $util.emptyArray; - - /** - * Creates a new Product instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Product - * @static - * @param {google.cloud.vision.v1p4beta1.IProduct=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Product} Product instance - */ - Product.create = function create(properties) { - return new Product(properties); - }; - - /** - * Encodes the specified Product message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Product.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Product - * @static - * @param {google.cloud.vision.v1p4beta1.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Product.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.productCategory != null && Object.hasOwnProperty.call(message, "productCategory")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.productCategory); - if (message.productLabels != null && message.productLabels.length) - for (var i = 0; i < message.productLabels.length; ++i) - $root.google.cloud.vision.v1p4beta1.Product.KeyValue.encode(message.productLabels[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Product message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Product.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Product - * @static - * @param {google.cloud.vision.v1p4beta1.IProduct} message Product message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Product.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Product message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.Product - * @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.Product} Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Product.decode = function decode(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.Product(); - 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; - } - case 4: { - message.productCategory = reader.string(); - break; - } - case 5: { - if (!(message.productLabels && message.productLabels.length)) - message.productLabels = []; - message.productLabels.push($root.google.cloud.vision.v1p4beta1.Product.KeyValue.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Product message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Product - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Product} Product - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Product.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Product message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.Product - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Product.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.productCategory != null && message.hasOwnProperty("productCategory")) - if (!$util.isString(message.productCategory)) - return "productCategory: string expected"; - if (message.productLabels != null && message.hasOwnProperty("productLabels")) { - if (!Array.isArray(message.productLabels)) - return "productLabels: array expected"; - for (var i = 0; i < message.productLabels.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.Product.KeyValue.verify(message.productLabels[i]); - if (error) - return "productLabels." + error; - } - } - return null; - }; - - /** - * Creates a Product message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Product - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Product} Product - */ - Product.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Product) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Product(); - 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); - if (object.productCategory != null) - message.productCategory = String(object.productCategory); - if (object.productLabels) { - if (!Array.isArray(object.productLabels)) - throw TypeError(".google.cloud.vision.v1p4beta1.Product.productLabels: array expected"); - message.productLabels = []; - for (var i = 0; i < object.productLabels.length; ++i) { - if (typeof object.productLabels[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Product.productLabels: object expected"); - message.productLabels[i] = $root.google.cloud.vision.v1p4beta1.Product.KeyValue.fromObject(object.productLabels[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Product message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Product - * @static - * @param {google.cloud.vision.v1p4beta1.Product} message Product - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Product.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productLabels = []; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.description = ""; - object.productCategory = ""; - } - 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; - if (message.productCategory != null && message.hasOwnProperty("productCategory")) - object.productCategory = message.productCategory; - if (message.productLabels && message.productLabels.length) { - object.productLabels = []; - for (var j = 0; j < message.productLabels.length; ++j) - object.productLabels[j] = $root.google.cloud.vision.v1p4beta1.Product.KeyValue.toObject(message.productLabels[j], options); - } - return object; - }; - - /** - * Converts this Product to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Product - * @instance - * @returns {Object.} JSON object - */ - Product.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Product - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Product - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Product.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Product"; - }; - - Product.KeyValue = (function() { - - /** - * Properties of a KeyValue. - * @memberof google.cloud.vision.v1p4beta1.Product - * @interface IKeyValue - * @property {string|null} [key] KeyValue key - * @property {string|null} [value] KeyValue value - */ - - /** - * Constructs a new KeyValue. - * @memberof google.cloud.vision.v1p4beta1.Product - * @classdesc Represents a KeyValue. - * @implements IKeyValue - * @constructor - * @param {google.cloud.vision.v1p4beta1.Product.IKeyValue=} [properties] Properties to set - */ - function KeyValue(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]]; - } - - /** - * KeyValue key. - * @member {string} key - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @instance - */ - KeyValue.prototype.key = ""; - - /** - * KeyValue value. - * @member {string} value - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @instance - */ - KeyValue.prototype.value = ""; - - /** - * Creates a new KeyValue instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1p4beta1.Product.IKeyValue=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Product.KeyValue} KeyValue instance - */ - KeyValue.create = function create(properties) { - return new KeyValue(properties); - }; - - /** - * Encodes the specified KeyValue message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Product.KeyValue.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1p4beta1.Product.IKeyValue} message KeyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified KeyValue message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Product.KeyValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1p4beta1.Product.IKeyValue} message KeyValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - KeyValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a KeyValue message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @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.Product.KeyValue} KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValue.decode = function decode(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.Product.KeyValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.key = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a KeyValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Product.KeyValue} KeyValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - KeyValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a KeyValue message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - KeyValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a KeyValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Product.KeyValue} KeyValue - */ - KeyValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Product.KeyValue) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Product.KeyValue(); - if (object.key != null) - message.key = String(object.key); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a KeyValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @static - * @param {google.cloud.vision.v1p4beta1.Product.KeyValue} message KeyValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - KeyValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.key = ""; - object.value = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this KeyValue to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @instance - * @returns {Object.} JSON object - */ - KeyValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for KeyValue - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Product.KeyValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - KeyValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Product.KeyValue"; - }; - - return KeyValue; - })(); - - return Product; - })(); - - v1p4beta1.ProductSet = (function() { - - /** - * Properties of a ProductSet. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IProductSet - * @property {string|null} [name] ProductSet name - * @property {string|null} [displayName] ProductSet displayName - * @property {google.protobuf.ITimestamp|null} [indexTime] ProductSet indexTime - * @property {google.rpc.IStatus|null} [indexError] ProductSet indexError - */ - - /** - * Constructs a new ProductSet. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ProductSet. - * @implements IProductSet - * @constructor - * @param {google.cloud.vision.v1p4beta1.IProductSet=} [properties] Properties to set - */ - function ProductSet(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]]; - } - - /** - * ProductSet name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @instance - */ - ProductSet.prototype.name = ""; - - /** - * ProductSet displayName. - * @member {string} displayName - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @instance - */ - ProductSet.prototype.displayName = ""; - - /** - * ProductSet indexTime. - * @member {google.protobuf.ITimestamp|null|undefined} indexTime - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @instance - */ - ProductSet.prototype.indexTime = null; - - /** - * ProductSet indexError. - * @member {google.rpc.IStatus|null|undefined} indexError - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @instance - */ - ProductSet.prototype.indexError = null; - - /** - * Creates a new ProductSet instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSet=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ProductSet} ProductSet instance - */ - ProductSet.create = function create(properties) { - return new ProductSet(properties); - }; - - /** - * Encodes the specified ProductSet message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSet.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSet} message ProductSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.indexTime != null && Object.hasOwnProperty.call(message, "indexTime")) - $root.google.protobuf.Timestamp.encode(message.indexTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.indexError != null && Object.hasOwnProperty.call(message, "indexError")) - $root.google.rpc.Status.encode(message.indexError, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProductSet message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSet} message ProductSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSet message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @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.ProductSet} ProductSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSet.decode = function decode(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.ProductSet(); - 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.indexTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 4: { - message.indexError = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ProductSet} ProductSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSet message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSet.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.indexTime != null && message.hasOwnProperty("indexTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.indexTime); - if (error) - return "indexTime." + error; - } - if (message.indexError != null && message.hasOwnProperty("indexError")) { - var error = $root.google.rpc.Status.verify(message.indexError); - if (error) - return "indexError." + error; - } - return null; - }; - - /** - * Creates a ProductSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ProductSet} ProductSet - */ - ProductSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ProductSet) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ProductSet(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.indexTime != null) { - if (typeof object.indexTime !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSet.indexTime: object expected"); - message.indexTime = $root.google.protobuf.Timestamp.fromObject(object.indexTime); - } - if (object.indexError != null) { - if (typeof object.indexError !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ProductSet.indexError: object expected"); - message.indexError = $root.google.rpc.Status.fromObject(object.indexError); - } - return message; - }; - - /** - * Creates a plain object from a ProductSet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSet} message ProductSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.indexTime = null; - object.indexError = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.indexTime != null && message.hasOwnProperty("indexTime")) - object.indexTime = $root.google.protobuf.Timestamp.toObject(message.indexTime, options); - if (message.indexError != null && message.hasOwnProperty("indexError")) - object.indexError = $root.google.rpc.Status.toObject(message.indexError, options); - return object; - }; - - /** - * Converts this ProductSet to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @instance - * @returns {Object.} JSON object - */ - ProductSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSet - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ProductSet - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ProductSet"; - }; - - return ProductSet; - })(); - - v1p4beta1.ReferenceImage = (function() { - - /** - * Properties of a ReferenceImage. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IReferenceImage - * @property {string|null} [name] ReferenceImage name - * @property {string|null} [uri] ReferenceImage uri - * @property {Array.|null} [boundingPolys] ReferenceImage boundingPolys - */ - - /** - * Constructs a new ReferenceImage. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ReferenceImage. - * @implements IReferenceImage - * @constructor - * @param {google.cloud.vision.v1p4beta1.IReferenceImage=} [properties] Properties to set - */ - function ReferenceImage(properties) { - this.boundingPolys = []; - 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]]; - } - - /** - * ReferenceImage name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.name = ""; - - /** - * ReferenceImage uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.uri = ""; - - /** - * ReferenceImage boundingPolys. - * @member {Array.} boundingPolys - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @instance - */ - ReferenceImage.prototype.boundingPolys = $util.emptyArray; - - /** - * Creates a new ReferenceImage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @static - * @param {google.cloud.vision.v1p4beta1.IReferenceImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ReferenceImage} ReferenceImage instance - */ - ReferenceImage.create = function create(properties) { - return new ReferenceImage(properties); - }; - - /** - * Encodes the specified ReferenceImage message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ReferenceImage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @static - * @param {google.cloud.vision.v1p4beta1.IReferenceImage} message ReferenceImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReferenceImage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); - if (message.boundingPolys != null && message.boundingPolys.length) - for (var i = 0; i < message.boundingPolys.length; ++i) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPolys[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ReferenceImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ReferenceImage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @static - * @param {google.cloud.vision.v1p4beta1.IReferenceImage} message ReferenceImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReferenceImage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @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.ReferenceImage} ReferenceImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReferenceImage.decode = function decode(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.ReferenceImage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.uri = reader.string(); - break; - } - case 3: { - if (!(message.boundingPolys && message.boundingPolys.length)) - message.boundingPolys = []; - message.boundingPolys.push($root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReferenceImage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ReferenceImage} ReferenceImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReferenceImage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReferenceImage message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReferenceImage.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.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.boundingPolys != null && message.hasOwnProperty("boundingPolys")) { - if (!Array.isArray(message.boundingPolys)) - return "boundingPolys: array expected"; - for (var i = 0; i < message.boundingPolys.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.boundingPolys[i]); - if (error) - return "boundingPolys." + error; - } - } - return null; - }; - - /** - * Creates a ReferenceImage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ReferenceImage} ReferenceImage - */ - ReferenceImage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ReferenceImage) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ReferenceImage(); - if (object.name != null) - message.name = String(object.name); - if (object.uri != null) - message.uri = String(object.uri); - if (object.boundingPolys) { - if (!Array.isArray(object.boundingPolys)) - throw TypeError(".google.cloud.vision.v1p4beta1.ReferenceImage.boundingPolys: array expected"); - message.boundingPolys = []; - for (var i = 0; i < object.boundingPolys.length; ++i) { - if (typeof object.boundingPolys[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ReferenceImage.boundingPolys: object expected"); - message.boundingPolys[i] = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPolys[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ReferenceImage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @static - * @param {google.cloud.vision.v1p4beta1.ReferenceImage} message ReferenceImage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReferenceImage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.boundingPolys = []; - if (options.defaults) { - object.name = ""; - object.uri = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.boundingPolys && message.boundingPolys.length) { - object.boundingPolys = []; - for (var j = 0; j < message.boundingPolys.length; ++j) - object.boundingPolys[j] = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPolys[j], options); - } - return object; - }; - - /** - * Converts this ReferenceImage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @instance - * @returns {Object.} JSON object - */ - ReferenceImage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReferenceImage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ReferenceImage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReferenceImage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ReferenceImage"; - }; - - return ReferenceImage; - })(); - - v1p4beta1.CreateProductRequest = (function() { - - /** - * Properties of a CreateProductRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ICreateProductRequest - * @property {string|null} [parent] CreateProductRequest parent - * @property {google.cloud.vision.v1p4beta1.IProduct|null} [product] CreateProductRequest product - * @property {string|null} [productId] CreateProductRequest productId - */ - - /** - * Constructs a new CreateProductRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CreateProductRequest. - * @implements ICreateProductRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.ICreateProductRequest=} [properties] Properties to set - */ - function CreateProductRequest(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]]; - } - - /** - * CreateProductRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.parent = ""; - - /** - * CreateProductRequest product. - * @member {google.cloud.vision.v1p4beta1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.product = null; - - /** - * CreateProductRequest productId. - * @member {string} productId - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @instance - */ - CreateProductRequest.prototype.productId = ""; - - /** - * Creates a new CreateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CreateProductRequest} CreateProductRequest instance - */ - CreateProductRequest.create = function create(properties) { - return new CreateProductRequest(properties); - }; - - /** - * Encodes the specified CreateProductRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1p4beta1.Product.encode(message.product, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productId); - return writer; - }; - - /** - * Encodes the specified CreateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateProductRequest} message CreateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @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.CreateProductRequest} CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductRequest.decode = function decode(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.CreateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.product = $root.google.cloud.vision.v1p4beta1.Product.decode(reader, reader.uint32()); - break; - } - case 3: { - message.productId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.CreateProductRequest} CreateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1p4beta1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.productId != null && message.hasOwnProperty("productId")) - if (!$util.isString(message.productId)) - return "productId: string expected"; - return null; - }; - - /** - * Creates a CreateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CreateProductRequest} CreateProductRequest - */ - CreateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CreateProductRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.CreateProductRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.CreateProductRequest.product: object expected"); - message.product = $root.google.cloud.vision.v1p4beta1.Product.fromObject(object.product); - } - if (object.productId != null) - message.productId = String(object.productId); - return message; - }; - - /** - * Creates a plain object from a CreateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.CreateProductRequest} message CreateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.product = null; - object.productId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1p4beta1.Product.toObject(message.product, options); - if (message.productId != null && message.hasOwnProperty("productId")) - object.productId = message.productId; - return object; - }; - - /** - * Converts this CreateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @instance - * @returns {Object.} JSON object - */ - CreateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.CreateProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.CreateProductRequest"; - }; - - return CreateProductRequest; - })(); - - v1p4beta1.ListProductsRequest = (function() { - - /** - * Properties of a ListProductsRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IListProductsRequest - * @property {string|null} [parent] ListProductsRequest parent - * @property {number|null} [pageSize] ListProductsRequest pageSize - * @property {string|null} [pageToken] ListProductsRequest pageToken - */ - - /** - * Constructs a new ListProductsRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ListProductsRequest. - * @implements IListProductsRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IListProductsRequest=} [properties] Properties to set - */ - function ListProductsRequest(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]]; - } - - /** - * ListProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.parent = ""; - - /** - * ListProductsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageSize = 0; - - /** - * ListProductsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @instance - */ - ListProductsRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ListProductsRequest} ListProductsRequest instance - */ - ListProductsRequest.create = function create(properties) { - return new ListProductsRequest(properties); - }; - - /** - * Encodes the specified ListProductsRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsRequest} message ListProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsRequest} message ListProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @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.ListProductsRequest} ListProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsRequest.decode = function decode(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.ListProductsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ListProductsRequest} ListProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ListProductsRequest} ListProductsRequest - */ - ListProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ListProductsRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ListProductsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ListProductsRequest} message ListProductsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ListProductsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ListProductsRequest"; - }; - - return ListProductsRequest; - })(); - - v1p4beta1.ListProductsResponse = (function() { - - /** - * Properties of a ListProductsResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IListProductsResponse - * @property {Array.|null} [products] ListProductsResponse products - * @property {string|null} [nextPageToken] ListProductsResponse nextPageToken - */ - - /** - * Constructs a new ListProductsResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ListProductsResponse. - * @implements IListProductsResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IListProductsResponse=} [properties] Properties to set - */ - function ListProductsResponse(properties) { - this.products = []; - 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]]; - } - - /** - * ListProductsResponse products. - * @member {Array.} products - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @instance - */ - ListProductsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ListProductsResponse} ListProductsResponse instance - */ - ListProductsResponse.create = function create(properties) { - return new ListProductsResponse(properties); - }; - - /** - * Encodes the specified ListProductsResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsResponse} message ListProductsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.vision.v1p4beta1.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsResponse} message ListProductsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @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.ListProductsResponse} ListProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsResponse.decode = function decode(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.ListProductsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.vision.v1p4beta1.Product.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ListProductsResponse} ListProductsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsResponse message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ListProductsResponse} ListProductsResponse - */ - ListProductsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ListProductsResponse) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ListProductsResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.vision.v1p4beta1.ListProductsResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ListProductsResponse.products: object expected"); - message.products[i] = $root.google.cloud.vision.v1p4beta1.Product.fromObject(object.products[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.ListProductsResponse} message ListProductsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.vision.v1p4beta1.Product.toObject(message.products[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ListProductsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ListProductsResponse"; - }; - - return ListProductsResponse; - })(); - - v1p4beta1.GetProductRequest = (function() { - - /** - * Properties of a GetProductRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IGetProductRequest - * @property {string|null} [name] GetProductRequest name - */ - - /** - * Constructs a new GetProductRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a GetProductRequest. - * @implements IGetProductRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IGetProductRequest=} [properties] Properties to set - */ - function GetProductRequest(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]]; - } - - /** - * GetProductRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @instance - */ - GetProductRequest.prototype.name = ""; - - /** - * Creates a new GetProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.GetProductRequest} GetProductRequest instance - */ - GetProductRequest.create = function create(properties) { - return new GetProductRequest(properties); - }; - - /** - * Encodes the specified GetProductRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetProductRequest} message GetProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetProductRequest} message GetProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @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.GetProductRequest} GetProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductRequest.decode = function decode(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.GetProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.GetProductRequest} GetProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.GetProductRequest} GetProductRequest - */ - GetProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.GetProductRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.GetProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.GetProductRequest} message GetProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @instance - * @returns {Object.} JSON object - */ - GetProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.GetProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.GetProductRequest"; - }; - - return GetProductRequest; - })(); - - v1p4beta1.UpdateProductRequest = (function() { - - /** - * Properties of an UpdateProductRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IUpdateProductRequest - * @property {google.cloud.vision.v1p4beta1.IProduct|null} [product] UpdateProductRequest product - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductRequest updateMask - */ - - /** - * Constructs a new UpdateProductRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an UpdateProductRequest. - * @implements IUpdateProductRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IUpdateProductRequest=} [properties] Properties to set - */ - function UpdateProductRequest(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]]; - } - - /** - * UpdateProductRequest product. - * @member {google.cloud.vision.v1p4beta1.IProduct|null|undefined} product - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.product = null; - - /** - * UpdateProductRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @instance - */ - UpdateProductRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IUpdateProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.UpdateProductRequest} UpdateProductRequest instance - */ - UpdateProductRequest.create = function create(properties) { - return new UpdateProductRequest(properties); - }; - - /** - * Encodes the specified UpdateProductRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.UpdateProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - $root.google.cloud.vision.v1p4beta1.Product.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.UpdateProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IUpdateProductRequest} message UpdateProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @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.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductRequest.decode = function decode(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.UpdateProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.product = $root.google.cloud.vision.v1p4beta1.Product.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.UpdateProductRequest} UpdateProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UpdateProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.product != null && message.hasOwnProperty("product")) { - var error = $root.google.cloud.vision.v1p4beta1.Product.verify(message.product); - if (error) - return "product." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; - - /** - * Creates an UpdateProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.UpdateProductRequest} UpdateProductRequest - */ - UpdateProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.UpdateProductRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.UpdateProductRequest(); - if (object.product != null) { - if (typeof object.product !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.UpdateProductRequest.product: object expected"); - message.product = $root.google.cloud.vision.v1p4beta1.Product.fromObject(object.product); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.UpdateProductRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; - - /** - * Creates a plain object from an UpdateProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.UpdateProductRequest} message UpdateProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.product = null; - object.updateMask = null; - } - if (message.product != null && message.hasOwnProperty("product")) - object.product = $root.google.cloud.vision.v1p4beta1.Product.toObject(message.product, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; - - /** - * Converts this UpdateProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdateProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.UpdateProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdateProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.UpdateProductRequest"; - }; - - return UpdateProductRequest; - })(); - - v1p4beta1.DeleteProductRequest = (function() { - - /** - * Properties of a DeleteProductRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IDeleteProductRequest - * @property {string|null} [name] DeleteProductRequest name - */ - - /** - * Constructs a new DeleteProductRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a DeleteProductRequest. - * @implements IDeleteProductRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IDeleteProductRequest=} [properties] Properties to set - */ - function DeleteProductRequest(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]]; - } - - /** - * DeleteProductRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @instance - */ - DeleteProductRequest.prototype.name = ""; - - /** - * Creates a new DeleteProductRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteProductRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.DeleteProductRequest} DeleteProductRequest instance - */ - DeleteProductRequest.create = function create(properties) { - return new DeleteProductRequest(properties); - }; - - /** - * Encodes the specified DeleteProductRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteProductRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteProductRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteProductRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteProductRequest} message DeleteProductRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @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.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decode = function decode(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.DeleteProductRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteProductRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.DeleteProductRequest} DeleteProductRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteProductRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteProductRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteProductRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.DeleteProductRequest} DeleteProductRequest - */ - DeleteProductRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.DeleteProductRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.DeleteProductRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteProductRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @static - * @param {google.cloud.vision.v1p4beta1.DeleteProductRequest} message DeleteProductRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteProductRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteProductRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteProductRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteProductRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.DeleteProductRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteProductRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.DeleteProductRequest"; - }; - - return DeleteProductRequest; - })(); - - v1p4beta1.CreateProductSetRequest = (function() { - - /** - * Properties of a CreateProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ICreateProductSetRequest - * @property {string|null} [parent] CreateProductSetRequest parent - * @property {google.cloud.vision.v1p4beta1.IProductSet|null} [productSet] CreateProductSetRequest productSet - * @property {string|null} [productSetId] CreateProductSetRequest productSetId - */ - - /** - * Constructs a new CreateProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CreateProductSetRequest. - * @implements ICreateProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.ICreateProductSetRequest=} [properties] Properties to set - */ - function CreateProductSetRequest(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]]; - } - - /** - * CreateProductSetRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.parent = ""; - - /** - * CreateProductSetRequest productSet. - * @member {google.cloud.vision.v1p4beta1.IProductSet|null|undefined} productSet - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.productSet = null; - - /** - * CreateProductSetRequest productSetId. - * @member {string} productSetId - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @instance - */ - CreateProductSetRequest.prototype.productSetId = ""; - - /** - * Creates a new CreateProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CreateProductSetRequest} CreateProductSetRequest instance - */ - CreateProductSetRequest.create = function create(properties) { - return new CreateProductSetRequest(properties); - }; - - /** - * Encodes the specified CreateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateProductSetRequest} message CreateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - $root.google.cloud.vision.v1p4beta1.ProductSet.encode(message.productSet, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.productSetId != null && Object.hasOwnProperty.call(message, "productSetId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.productSetId); - return writer; - }; - - /** - * Encodes the specified CreateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateProductSetRequest} message CreateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @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.CreateProductSetRequest} CreateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductSetRequest.decode = function decode(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.CreateProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.productSet = $root.google.cloud.vision.v1p4beta1.ProductSet.decode(reader, reader.uint32()); - break; - } - case 3: { - message.productSetId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.CreateProductSetRequest} CreateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.productSet != null && message.hasOwnProperty("productSet")) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSet.verify(message.productSet); - if (error) - return "productSet." + error; - } - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - if (!$util.isString(message.productSetId)) - return "productSetId: string expected"; - return null; - }; - - /** - * Creates a CreateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CreateProductSetRequest} CreateProductSetRequest - */ - CreateProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CreateProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.CreateProductSetRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.productSet != null) { - if (typeof object.productSet !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.CreateProductSetRequest.productSet: object expected"); - message.productSet = $root.google.cloud.vision.v1p4beta1.ProductSet.fromObject(object.productSet); - } - if (object.productSetId != null) - message.productSetId = String(object.productSetId); - return message; - }; - - /** - * Creates a plain object from a CreateProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.CreateProductSetRequest} message CreateProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.productSet = null; - object.productSetId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = $root.google.cloud.vision.v1p4beta1.ProductSet.toObject(message.productSet, options); - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - object.productSetId = message.productSetId; - return object; - }; - - /** - * Converts this CreateProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - CreateProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.CreateProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.CreateProductSetRequest"; - }; - - return CreateProductSetRequest; - })(); - - v1p4beta1.ListProductSetsRequest = (function() { - - /** - * Properties of a ListProductSetsRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IListProductSetsRequest - * @property {string|null} [parent] ListProductSetsRequest parent - * @property {number|null} [pageSize] ListProductSetsRequest pageSize - * @property {string|null} [pageToken] ListProductSetsRequest pageToken - */ - - /** - * Constructs a new ListProductSetsRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ListProductSetsRequest. - * @implements IListProductSetsRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IListProductSetsRequest=} [properties] Properties to set - */ - function ListProductSetsRequest(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]]; - } - - /** - * ListProductSetsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.parent = ""; - - /** - * ListProductSetsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.pageSize = 0; - - /** - * ListProductSetsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @instance - */ - ListProductSetsRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductSetsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductSetsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ListProductSetsRequest} ListProductSetsRequest instance - */ - ListProductSetsRequest.create = function create(properties) { - return new ListProductSetsRequest(properties); - }; - - /** - * Encodes the specified ListProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductSetsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductSetsRequest} message ListProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductSetsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductSetsRequest} message ListProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @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.ListProductSetsRequest} ListProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsRequest.decode = function decode(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.ListProductSetsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductSetsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ListProductSetsRequest} ListProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductSetsRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductSetsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ListProductSetsRequest} ListProductSetsRequest - */ - ListProductSetsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ListProductSetsRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ListProductSetsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductSetsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ListProductSetsRequest} message ListProductSetsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductSetsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductSetsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductSetsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductSetsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductSetsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ListProductSetsRequest"; - }; - - return ListProductSetsRequest; - })(); - - v1p4beta1.ListProductSetsResponse = (function() { - - /** - * Properties of a ListProductSetsResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IListProductSetsResponse - * @property {Array.|null} [productSets] ListProductSetsResponse productSets - * @property {string|null} [nextPageToken] ListProductSetsResponse nextPageToken - */ - - /** - * Constructs a new ListProductSetsResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ListProductSetsResponse. - * @implements IListProductSetsResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IListProductSetsResponse=} [properties] Properties to set - */ - function ListProductSetsResponse(properties) { - this.productSets = []; - 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]]; - } - - /** - * ListProductSetsResponse productSets. - * @member {Array.} productSets - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @instance - */ - ListProductSetsResponse.prototype.productSets = $util.emptyArray; - - /** - * ListProductSetsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @instance - */ - ListProductSetsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductSetsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductSetsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ListProductSetsResponse} ListProductSetsResponse instance - */ - ListProductSetsResponse.create = function create(properties) { - return new ListProductSetsResponse(properties); - }; - - /** - * Encodes the specified ListProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductSetsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductSetsResponse} message ListProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSets != null && message.productSets.length) - for (var i = 0; i < message.productSets.length; ++i) - $root.google.cloud.vision.v1p4beta1.ProductSet.encode(message.productSets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductSetsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductSetsResponse} message ListProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductSetsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @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.ListProductSetsResponse} ListProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsResponse.decode = function decode(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.ListProductSetsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.productSets && message.productSets.length)) - message.productSets = []; - message.productSets.push($root.google.cloud.vision.v1p4beta1.ProductSet.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductSetsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ListProductSetsResponse} ListProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductSetsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductSetsResponse message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductSetsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.productSets != null && message.hasOwnProperty("productSets")) { - if (!Array.isArray(message.productSets)) - return "productSets: array expected"; - for (var i = 0; i < message.productSets.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSet.verify(message.productSets[i]); - if (error) - return "productSets." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ListProductSetsResponse} ListProductSetsResponse - */ - ListProductSetsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ListProductSetsResponse) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ListProductSetsResponse(); - if (object.productSets) { - if (!Array.isArray(object.productSets)) - throw TypeError(".google.cloud.vision.v1p4beta1.ListProductSetsResponse.productSets: array expected"); - message.productSets = []; - for (var i = 0; i < object.productSets.length; ++i) { - if (typeof object.productSets[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ListProductSetsResponse.productSets: object expected"); - message.productSets[i] = $root.google.cloud.vision.v1p4beta1.ProductSet.fromObject(object.productSets[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductSetsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.ListProductSetsResponse} message ListProductSetsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductSetsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.productSets = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.productSets && message.productSets.length) { - object.productSets = []; - for (var j = 0; j < message.productSets.length; ++j) - object.productSets[j] = $root.google.cloud.vision.v1p4beta1.ProductSet.toObject(message.productSets[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductSetsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductSetsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductSetsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ListProductSetsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductSetsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ListProductSetsResponse"; - }; - - return ListProductSetsResponse; - })(); - - v1p4beta1.GetProductSetRequest = (function() { - - /** - * Properties of a GetProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IGetProductSetRequest - * @property {string|null} [name] GetProductSetRequest name - */ - - /** - * Constructs a new GetProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a GetProductSetRequest. - * @implements IGetProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IGetProductSetRequest=} [properties] Properties to set - */ - function GetProductSetRequest(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]]; - } - - /** - * GetProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @instance - */ - GetProductSetRequest.prototype.name = ""; - - /** - * Creates a new GetProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.GetProductSetRequest} GetProductSetRequest instance - */ - GetProductSetRequest.create = function create(properties) { - return new GetProductSetRequest(properties); - }; - - /** - * Encodes the specified GetProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetProductSetRequest} message GetProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetProductSetRequest} message GetProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @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.GetProductSetRequest} GetProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductSetRequest.decode = function decode(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.GetProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.GetProductSetRequest} GetProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.GetProductSetRequest} GetProductSetRequest - */ - GetProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.GetProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.GetProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.GetProductSetRequest} message GetProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - GetProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.GetProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.GetProductSetRequest"; - }; - - return GetProductSetRequest; - })(); - - v1p4beta1.UpdateProductSetRequest = (function() { - - /** - * Properties of an UpdateProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IUpdateProductSetRequest - * @property {google.cloud.vision.v1p4beta1.IProductSet|null} [productSet] UpdateProductSetRequest productSet - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateProductSetRequest updateMask - */ - - /** - * Constructs a new UpdateProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an UpdateProductSetRequest. - * @implements IUpdateProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IUpdateProductSetRequest=} [properties] Properties to set - */ - function UpdateProductSetRequest(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]]; - } - - /** - * UpdateProductSetRequest productSet. - * @member {google.cloud.vision.v1p4beta1.IProductSet|null|undefined} productSet - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @instance - */ - UpdateProductSetRequest.prototype.productSet = null; - - /** - * UpdateProductSetRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @instance - */ - UpdateProductSetRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IUpdateProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.UpdateProductSetRequest} UpdateProductSetRequest instance - */ - UpdateProductSetRequest.create = function create(properties) { - return new UpdateProductSetRequest(properties); - }; - - /** - * Encodes the specified UpdateProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.UpdateProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IUpdateProductSetRequest} message UpdateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSet != null && Object.hasOwnProperty.call(message, "productSet")) - $root.google.cloud.vision.v1p4beta1.ProductSet.encode(message.productSet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.UpdateProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IUpdateProductSetRequest} message UpdateProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @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.UpdateProductSetRequest} UpdateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductSetRequest.decode = function decode(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.UpdateProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.productSet = $root.google.cloud.vision.v1p4beta1.ProductSet.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.UpdateProductSetRequest} UpdateProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UpdateProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.productSet != null && message.hasOwnProperty("productSet")) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSet.verify(message.productSet); - if (error) - return "productSet." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; - - /** - * Creates an UpdateProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.UpdateProductSetRequest} UpdateProductSetRequest - */ - UpdateProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.UpdateProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.UpdateProductSetRequest(); - if (object.productSet != null) { - if (typeof object.productSet !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.UpdateProductSetRequest.productSet: object expected"); - message.productSet = $root.google.cloud.vision.v1p4beta1.ProductSet.fromObject(object.productSet); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.UpdateProductSetRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; - - /** - * Creates a plain object from an UpdateProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.UpdateProductSetRequest} message UpdateProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.productSet = null; - object.updateMask = null; - } - if (message.productSet != null && message.hasOwnProperty("productSet")) - object.productSet = $root.google.cloud.vision.v1p4beta1.ProductSet.toObject(message.productSet, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; - - /** - * Converts this UpdateProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdateProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.UpdateProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdateProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.UpdateProductSetRequest"; - }; - - return UpdateProductSetRequest; - })(); - - v1p4beta1.DeleteProductSetRequest = (function() { - - /** - * Properties of a DeleteProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IDeleteProductSetRequest - * @property {string|null} [name] DeleteProductSetRequest name - */ - - /** - * Constructs a new DeleteProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a DeleteProductSetRequest. - * @implements IDeleteProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IDeleteProductSetRequest=} [properties] Properties to set - */ - function DeleteProductSetRequest(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]]; - } - - /** - * DeleteProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @instance - */ - DeleteProductSetRequest.prototype.name = ""; - - /** - * Creates a new DeleteProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.DeleteProductSetRequest} DeleteProductSetRequest instance - */ - DeleteProductSetRequest.create = function create(properties) { - return new DeleteProductSetRequest(properties); - }; - - /** - * Encodes the specified DeleteProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteProductSetRequest} message DeleteProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteProductSetRequest} message DeleteProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @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.DeleteProductSetRequest} DeleteProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductSetRequest.decode = function decode(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.DeleteProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.DeleteProductSetRequest} DeleteProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteProductSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.DeleteProductSetRequest} DeleteProductSetRequest - */ - DeleteProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.DeleteProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.DeleteProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.DeleteProductSetRequest} message DeleteProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.DeleteProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.DeleteProductSetRequest"; - }; - - return DeleteProductSetRequest; - })(); - - v1p4beta1.CreateReferenceImageRequest = (function() { - - /** - * Properties of a CreateReferenceImageRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ICreateReferenceImageRequest - * @property {string|null} [parent] CreateReferenceImageRequest parent - * @property {google.cloud.vision.v1p4beta1.IReferenceImage|null} [referenceImage] CreateReferenceImageRequest referenceImage - * @property {string|null} [referenceImageId] CreateReferenceImageRequest referenceImageId - */ - - /** - * Constructs a new CreateReferenceImageRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CreateReferenceImageRequest. - * @implements ICreateReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest=} [properties] Properties to set - */ - function CreateReferenceImageRequest(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]]; - } - - /** - * CreateReferenceImageRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.parent = ""; - - /** - * CreateReferenceImageRequest referenceImage. - * @member {google.cloud.vision.v1p4beta1.IReferenceImage|null|undefined} referenceImage - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.referenceImage = null; - - /** - * CreateReferenceImageRequest referenceImageId. - * @member {string} referenceImageId - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @instance - */ - CreateReferenceImageRequest.prototype.referenceImageId = ""; - - /** - * Creates a new CreateReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CreateReferenceImageRequest} CreateReferenceImageRequest instance - */ - CreateReferenceImageRequest.create = function create(properties) { - return new CreateReferenceImageRequest(properties); - }; - - /** - * Encodes the specified CreateReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest} message CreateReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.referenceImage != null && Object.hasOwnProperty.call(message, "referenceImage")) - $root.google.cloud.vision.v1p4beta1.ReferenceImage.encode(message.referenceImage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.referenceImageId != null && Object.hasOwnProperty.call(message, "referenceImageId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.referenceImageId); - return writer; - }; - - /** - * Encodes the specified CreateReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CreateReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest} message CreateReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @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.CreateReferenceImageRequest} CreateReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateReferenceImageRequest.decode = function decode(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.CreateReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.referenceImage = $root.google.cloud.vision.v1p4beta1.ReferenceImage.decode(reader, reader.uint32()); - break; - } - case 3: { - message.referenceImageId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.CreateReferenceImageRequest} CreateReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.referenceImage != null && message.hasOwnProperty("referenceImage")) { - var error = $root.google.cloud.vision.v1p4beta1.ReferenceImage.verify(message.referenceImage); - if (error) - return "referenceImage." + error; - } - if (message.referenceImageId != null && message.hasOwnProperty("referenceImageId")) - if (!$util.isString(message.referenceImageId)) - return "referenceImageId: string expected"; - return null; - }; - - /** - * Creates a CreateReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CreateReferenceImageRequest} CreateReferenceImageRequest - */ - CreateReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.referenceImage != null) { - if (typeof object.referenceImage !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.CreateReferenceImageRequest.referenceImage: object expected"); - message.referenceImage = $root.google.cloud.vision.v1p4beta1.ReferenceImage.fromObject(object.referenceImage); - } - if (object.referenceImageId != null) - message.referenceImageId = String(object.referenceImageId); - return message; - }; - - /** - * Creates a plain object from a CreateReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.CreateReferenceImageRequest} message CreateReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.referenceImage = null; - object.referenceImageId = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.referenceImage != null && message.hasOwnProperty("referenceImage")) - object.referenceImage = $root.google.cloud.vision.v1p4beta1.ReferenceImage.toObject(message.referenceImage, options); - if (message.referenceImageId != null && message.hasOwnProperty("referenceImageId")) - object.referenceImageId = message.referenceImageId; - return object; - }; - - /** - * Converts this CreateReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - CreateReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.CreateReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.CreateReferenceImageRequest"; - }; - - return CreateReferenceImageRequest; - })(); - - v1p4beta1.ListReferenceImagesRequest = (function() { - - /** - * Properties of a ListReferenceImagesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IListReferenceImagesRequest - * @property {string|null} [parent] ListReferenceImagesRequest parent - * @property {number|null} [pageSize] ListReferenceImagesRequest pageSize - * @property {string|null} [pageToken] ListReferenceImagesRequest pageToken - */ - - /** - * Constructs a new ListReferenceImagesRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ListReferenceImagesRequest. - * @implements IListReferenceImagesRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesRequest=} [properties] Properties to set - */ - function ListReferenceImagesRequest(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]]; - } - - /** - * ListReferenceImagesRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.parent = ""; - - /** - * ListReferenceImagesRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.pageSize = 0; - - /** - * ListReferenceImagesRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @instance - */ - ListReferenceImagesRequest.prototype.pageToken = ""; - - /** - * Creates a new ListReferenceImagesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ListReferenceImagesRequest} ListReferenceImagesRequest instance - */ - ListReferenceImagesRequest.create = function create(properties) { - return new ListReferenceImagesRequest(properties); - }; - - /** - * Encodes the specified ListReferenceImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListReferenceImagesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesRequest} message ListReferenceImagesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListReferenceImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListReferenceImagesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesRequest} message ListReferenceImagesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @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.ListReferenceImagesRequest} ListReferenceImagesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesRequest.decode = function decode(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.ListReferenceImagesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListReferenceImagesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ListReferenceImagesRequest} ListReferenceImagesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListReferenceImagesRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListReferenceImagesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListReferenceImagesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ListReferenceImagesRequest} ListReferenceImagesRequest - */ - ListReferenceImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListReferenceImagesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ListReferenceImagesRequest} message ListReferenceImagesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListReferenceImagesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListReferenceImagesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @instance - * @returns {Object.} JSON object - */ - ListReferenceImagesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListReferenceImagesRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListReferenceImagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ListReferenceImagesRequest"; - }; - - return ListReferenceImagesRequest; - })(); - - v1p4beta1.ListReferenceImagesResponse = (function() { - - /** - * Properties of a ListReferenceImagesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IListReferenceImagesResponse - * @property {Array.|null} [referenceImages] ListReferenceImagesResponse referenceImages - * @property {number|null} [pageSize] ListReferenceImagesResponse pageSize - * @property {string|null} [nextPageToken] ListReferenceImagesResponse nextPageToken - */ - - /** - * Constructs a new ListReferenceImagesResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ListReferenceImagesResponse. - * @implements IListReferenceImagesResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesResponse=} [properties] Properties to set - */ - function ListReferenceImagesResponse(properties) { - this.referenceImages = []; - 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]]; - } - - /** - * ListReferenceImagesResponse referenceImages. - * @member {Array.} referenceImages - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.referenceImages = $util.emptyArray; - - /** - * ListReferenceImagesResponse pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.pageSize = 0; - - /** - * ListReferenceImagesResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @instance - */ - ListReferenceImagesResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListReferenceImagesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ListReferenceImagesResponse} ListReferenceImagesResponse instance - */ - ListReferenceImagesResponse.create = function create(properties) { - return new ListReferenceImagesResponse(properties); - }; - - /** - * Encodes the specified ListReferenceImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListReferenceImagesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesResponse} message ListReferenceImagesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.referenceImages != null && message.referenceImages.length) - for (var i = 0; i < message.referenceImages.length; ++i) - $root.google.cloud.vision.v1p4beta1.ReferenceImage.encode(message.referenceImages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListReferenceImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListReferenceImagesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListReferenceImagesResponse} message ListReferenceImagesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListReferenceImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @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.ListReferenceImagesResponse} ListReferenceImagesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesResponse.decode = function decode(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.ListReferenceImagesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.referenceImages && message.referenceImages.length)) - message.referenceImages = []; - message.referenceImages.push($root.google.cloud.vision.v1p4beta1.ReferenceImage.decode(reader, reader.uint32())); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListReferenceImagesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ListReferenceImagesResponse} ListReferenceImagesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListReferenceImagesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListReferenceImagesResponse message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListReferenceImagesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.referenceImages != null && message.hasOwnProperty("referenceImages")) { - if (!Array.isArray(message.referenceImages)) - return "referenceImages: array expected"; - for (var i = 0; i < message.referenceImages.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.ReferenceImage.verify(message.referenceImages[i]); - if (error) - return "referenceImages." + error; - } - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListReferenceImagesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ListReferenceImagesResponse} ListReferenceImagesResponse - */ - ListReferenceImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ListReferenceImagesResponse) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ListReferenceImagesResponse(); - if (object.referenceImages) { - if (!Array.isArray(object.referenceImages)) - throw TypeError(".google.cloud.vision.v1p4beta1.ListReferenceImagesResponse.referenceImages: array expected"); - message.referenceImages = []; - for (var i = 0; i < object.referenceImages.length; ++i) { - if (typeof object.referenceImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ListReferenceImagesResponse.referenceImages: object expected"); - message.referenceImages[i] = $root.google.cloud.vision.v1p4beta1.ReferenceImage.fromObject(object.referenceImages[i]); - } - } - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListReferenceImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @static - * @param {google.cloud.vision.v1p4beta1.ListReferenceImagesResponse} message ListReferenceImagesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListReferenceImagesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.referenceImages = []; - if (options.defaults) { - object.pageSize = 0; - object.nextPageToken = ""; - } - if (message.referenceImages && message.referenceImages.length) { - object.referenceImages = []; - for (var j = 0; j < message.referenceImages.length; ++j) - object.referenceImages[j] = $root.google.cloud.vision.v1p4beta1.ReferenceImage.toObject(message.referenceImages[j], options); - } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListReferenceImagesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @instance - * @returns {Object.} JSON object - */ - ListReferenceImagesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListReferenceImagesResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ListReferenceImagesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListReferenceImagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ListReferenceImagesResponse"; - }; - - return ListReferenceImagesResponse; - })(); - - v1p4beta1.GetReferenceImageRequest = (function() { - - /** - * Properties of a GetReferenceImageRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IGetReferenceImageRequest - * @property {string|null} [name] GetReferenceImageRequest name - */ - - /** - * Constructs a new GetReferenceImageRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a GetReferenceImageRequest. - * @implements IGetReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IGetReferenceImageRequest=} [properties] Properties to set - */ - function GetReferenceImageRequest(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]]; - } - - /** - * GetReferenceImageRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @instance - */ - GetReferenceImageRequest.prototype.name = ""; - - /** - * Creates a new GetReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.GetReferenceImageRequest} GetReferenceImageRequest instance - */ - GetReferenceImageRequest.create = function create(properties) { - return new GetReferenceImageRequest(properties); - }; - - /** - * Encodes the specified GetReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetReferenceImageRequest} message GetReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GetReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IGetReferenceImageRequest} message GetReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @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.GetReferenceImageRequest} GetReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetReferenceImageRequest.decode = function decode(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.GetReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.GetReferenceImageRequest} GetReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.GetReferenceImageRequest} GetReferenceImageRequest - */ - GetReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.GetReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.GetReferenceImageRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.GetReferenceImageRequest} message GetReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - GetReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.GetReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.GetReferenceImageRequest"; - }; - - return GetReferenceImageRequest; - })(); - - v1p4beta1.DeleteReferenceImageRequest = (function() { - - /** - * Properties of a DeleteReferenceImageRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IDeleteReferenceImageRequest - * @property {string|null} [name] DeleteReferenceImageRequest name - */ - - /** - * Constructs a new DeleteReferenceImageRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a DeleteReferenceImageRequest. - * @implements IDeleteReferenceImageRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest=} [properties] Properties to set - */ - function DeleteReferenceImageRequest(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]]; - } - - /** - * DeleteReferenceImageRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @instance - */ - DeleteReferenceImageRequest.prototype.name = ""; - - /** - * Creates a new DeleteReferenceImageRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest} DeleteReferenceImageRequest instance - */ - DeleteReferenceImageRequest.create = function create(properties) { - return new DeleteReferenceImageRequest(properties); - }; - - /** - * Encodes the specified DeleteReferenceImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest} message DeleteReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteReferenceImageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteReferenceImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest} message DeleteReferenceImageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteReferenceImageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @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.DeleteReferenceImageRequest} DeleteReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteReferenceImageRequest.decode = function decode(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.DeleteReferenceImageRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteReferenceImageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest} DeleteReferenceImageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteReferenceImageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteReferenceImageRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteReferenceImageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteReferenceImageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest} DeleteReferenceImageRequest - */ - DeleteReferenceImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteReferenceImageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @static - * @param {google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest} message DeleteReferenceImageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteReferenceImageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteReferenceImageRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteReferenceImageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteReferenceImageRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteReferenceImageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest"; - }; - - return DeleteReferenceImageRequest; - })(); - - v1p4beta1.AddProductToProductSetRequest = (function() { - - /** - * Properties of an AddProductToProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IAddProductToProductSetRequest - * @property {string|null} [name] AddProductToProductSetRequest name - * @property {string|null} [product] AddProductToProductSetRequest product - */ - - /** - * Constructs a new AddProductToProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AddProductToProductSetRequest. - * @implements IAddProductToProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest=} [properties] Properties to set - */ - function AddProductToProductSetRequest(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]]; - } - - /** - * AddProductToProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @instance - */ - AddProductToProductSetRequest.prototype.name = ""; - - /** - * AddProductToProductSetRequest product. - * @member {string} product - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @instance - */ - AddProductToProductSetRequest.prototype.product = ""; - - /** - * Creates a new AddProductToProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AddProductToProductSetRequest} AddProductToProductSetRequest instance - */ - AddProductToProductSetRequest.create = function create(properties) { - return new AddProductToProductSetRequest(properties); - }; - - /** - * Encodes the specified AddProductToProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AddProductToProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest} message AddProductToProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddProductToProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.product); - return writer; - }; - - /** - * Encodes the specified AddProductToProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AddProductToProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest} message AddProductToProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AddProductToProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @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.AddProductToProductSetRequest} AddProductToProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AddProductToProductSetRequest.decode = function decode(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.AddProductToProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.product = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AddProductToProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AddProductToProductSetRequest} AddProductToProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AddProductToProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AddProductToProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AddProductToProductSetRequest.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.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - return null; - }; - - /** - * Creates an AddProductToProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AddProductToProductSetRequest} AddProductToProductSetRequest - */ - AddProductToProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.product != null) - message.product = String(object.product); - return message; - }; - - /** - * Creates a plain object from an AddProductToProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.AddProductToProductSetRequest} message AddProductToProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AddProductToProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.product = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - return object; - }; - - /** - * Converts this AddProductToProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - AddProductToProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AddProductToProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.AddProductToProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AddProductToProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.AddProductToProductSetRequest"; - }; - - return AddProductToProductSetRequest; - })(); - - v1p4beta1.RemoveProductFromProductSetRequest = (function() { - - /** - * Properties of a RemoveProductFromProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IRemoveProductFromProductSetRequest - * @property {string|null} [name] RemoveProductFromProductSetRequest name - * @property {string|null} [product] RemoveProductFromProductSetRequest product - */ - - /** - * Constructs a new RemoveProductFromProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a RemoveProductFromProductSetRequest. - * @implements IRemoveProductFromProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest=} [properties] Properties to set - */ - function RemoveProductFromProductSetRequest(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]]; - } - - /** - * RemoveProductFromProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @instance - */ - RemoveProductFromProductSetRequest.prototype.name = ""; - - /** - * RemoveProductFromProductSetRequest product. - * @member {string} product - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @instance - */ - RemoveProductFromProductSetRequest.prototype.product = ""; - - /** - * Creates a new RemoveProductFromProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest instance - */ - RemoveProductFromProductSetRequest.create = function create(properties) { - return new RemoveProductFromProductSetRequest(properties); - }; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RemoveProductFromProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.product != null && Object.hasOwnProperty.call(message, "product")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.product); - return writer; - }; - - /** - * Encodes the specified RemoveProductFromProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RemoveProductFromProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @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.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RemoveProductFromProductSetRequest.decode = function decode(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.RemoveProductFromProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.product = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RemoveProductFromProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RemoveProductFromProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RemoveProductFromProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RemoveProductFromProductSetRequest.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.product != null && message.hasOwnProperty("product")) - if (!$util.isString(message.product)) - return "product: string expected"; - return null; - }; - - /** - * Creates a RemoveProductFromProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest} RemoveProductFromProductSetRequest - */ - RemoveProductFromProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.product != null) - message.product = String(object.product); - return message; - }; - - /** - * Creates a plain object from a RemoveProductFromProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest} message RemoveProductFromProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RemoveProductFromProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.product = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.product != null && message.hasOwnProperty("product")) - object.product = message.product; - return object; - }; - - /** - * Converts this RemoveProductFromProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - RemoveProductFromProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RemoveProductFromProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RemoveProductFromProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest"; - }; - - return RemoveProductFromProductSetRequest; - })(); - - v1p4beta1.ListProductsInProductSetRequest = (function() { - - /** - * Properties of a ListProductsInProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IListProductsInProductSetRequest - * @property {string|null} [name] ListProductsInProductSetRequest name - * @property {number|null} [pageSize] ListProductsInProductSetRequest pageSize - * @property {string|null} [pageToken] ListProductsInProductSetRequest pageToken - */ - - /** - * Constructs a new ListProductsInProductSetRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ListProductsInProductSetRequest. - * @implements IListProductsInProductSetRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest=} [properties] Properties to set - */ - function ListProductsInProductSetRequest(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]]; - } - - /** - * ListProductsInProductSetRequest name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.name = ""; - - /** - * ListProductsInProductSetRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.pageSize = 0; - - /** - * ListProductsInProductSetRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @instance - */ - ListProductsInProductSetRequest.prototype.pageToken = ""; - - /** - * Creates a new ListProductsInProductSetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest} ListProductsInProductSetRequest instance - */ - ListProductsInProductSetRequest.create = function create(properties) { - return new ListProductsInProductSetRequest(properties); - }; - - /** - * Encodes the specified ListProductsInProductSetRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest} message ListProductsInProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsInProductSetRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest} message ListProductsInProductSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @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.ListProductsInProductSetRequest} ListProductsInProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetRequest.decode = function decode(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.ListProductsInProductSetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsInProductSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest} ListProductsInProductSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsInProductSetRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsInProductSetRequest.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.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsInProductSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest} ListProductsInProductSetRequest - */ - ListProductsInProductSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsInProductSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest} message ListProductsInProductSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsInProductSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.pageSize = 0; - object.pageToken = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - return object; - }; - - /** - * Converts this ListProductsInProductSetRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @instance - * @returns {Object.} JSON object - */ - ListProductsInProductSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsInProductSetRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsInProductSetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest"; - }; - - return ListProductsInProductSetRequest; - })(); - - v1p4beta1.ListProductsInProductSetResponse = (function() { - - /** - * Properties of a ListProductsInProductSetResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IListProductsInProductSetResponse - * @property {Array.|null} [products] ListProductsInProductSetResponse products - * @property {string|null} [nextPageToken] ListProductsInProductSetResponse nextPageToken - */ - - /** - * Constructs a new ListProductsInProductSetResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ListProductsInProductSetResponse. - * @implements IListProductsInProductSetResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse=} [properties] Properties to set - */ - function ListProductsInProductSetResponse(properties) { - this.products = []; - 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]]; - } - - /** - * ListProductsInProductSetResponse products. - * @member {Array.} products - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @instance - */ - ListProductsInProductSetResponse.prototype.products = $util.emptyArray; - - /** - * ListProductsInProductSetResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @instance - */ - ListProductsInProductSetResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListProductsInProductSetResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse} ListProductsInProductSetResponse instance - */ - ListProductsInProductSetResponse.create = function create(properties) { - return new ListProductsInProductSetResponse(properties); - }; - - /** - * Encodes the specified ListProductsInProductSetResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse} message ListProductsInProductSetResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.products != null && message.products.length) - for (var i = 0; i < message.products.length; ++i) - $root.google.cloud.vision.v1p4beta1.Product.encode(message.products[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListProductsInProductSetResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse} message ListProductsInProductSetResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListProductsInProductSetResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @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.ListProductsInProductSetResponse} ListProductsInProductSetResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetResponse.decode = function decode(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.ListProductsInProductSetResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.products && message.products.length)) - message.products = []; - message.products.push($root.google.cloud.vision.v1p4beta1.Product.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListProductsInProductSetResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse} ListProductsInProductSetResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListProductsInProductSetResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListProductsInProductSetResponse message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListProductsInProductSetResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.products != null && message.hasOwnProperty("products")) { - if (!Array.isArray(message.products)) - return "products: array expected"; - for (var i = 0; i < message.products.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.Product.verify(message.products[i]); - if (error) - return "products." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListProductsInProductSetResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse} ListProductsInProductSetResponse - */ - ListProductsInProductSetResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse(); - if (object.products) { - if (!Array.isArray(object.products)) - throw TypeError(".google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse.products: array expected"); - message.products = []; - for (var i = 0; i < object.products.length; ++i) { - if (typeof object.products[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse.products: object expected"); - message.products[i] = $root.google.cloud.vision.v1p4beta1.Product.fromObject(object.products[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListProductsInProductSetResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @static - * @param {google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse} message ListProductsInProductSetResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListProductsInProductSetResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.products = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.products && message.products.length) { - object.products = []; - for (var j = 0; j < message.products.length; ++j) - object.products[j] = $root.google.cloud.vision.v1p4beta1.Product.toObject(message.products[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListProductsInProductSetResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @instance - * @returns {Object.} JSON object - */ - ListProductsInProductSetResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListProductsInProductSetResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListProductsInProductSetResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse"; - }; - - return ListProductsInProductSetResponse; - })(); - - v1p4beta1.ImportProductSetsGcsSource = (function() { - - /** - * Properties of an ImportProductSetsGcsSource. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IImportProductSetsGcsSource - * @property {string|null} [csvFileUri] ImportProductSetsGcsSource csvFileUri - */ - - /** - * Constructs a new ImportProductSetsGcsSource. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImportProductSetsGcsSource. - * @implements IImportProductSetsGcsSource - * @constructor - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource=} [properties] Properties to set - */ - function ImportProductSetsGcsSource(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]]; - } - - /** - * ImportProductSetsGcsSource csvFileUri. - * @member {string} csvFileUri - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @instance - */ - ImportProductSetsGcsSource.prototype.csvFileUri = ""; - - /** - * Creates a new ImportProductSetsGcsSource instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource} ImportProductSetsGcsSource instance - */ - ImportProductSetsGcsSource.create = function create(properties) { - return new ImportProductSetsGcsSource(properties); - }; - - /** - * Encodes the specified ImportProductSetsGcsSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource} message ImportProductSetsGcsSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsGcsSource.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.csvFileUri != null && Object.hasOwnProperty.call(message, "csvFileUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.csvFileUri); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsGcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource} message ImportProductSetsGcsSource message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsGcsSource.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @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.ImportProductSetsGcsSource} ImportProductSetsGcsSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsGcsSource.decode = function decode(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.ImportProductSetsGcsSource(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.csvFileUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsGcsSource message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource} ImportProductSetsGcsSource - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsGcsSource.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsGcsSource message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsGcsSource.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.csvFileUri != null && message.hasOwnProperty("csvFileUri")) - if (!$util.isString(message.csvFileUri)) - return "csvFileUri: string expected"; - return null; - }; - - /** - * Creates an ImportProductSetsGcsSource message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource} ImportProductSetsGcsSource - */ - ImportProductSetsGcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource(); - if (object.csvFileUri != null) - message.csvFileUri = String(object.csvFileUri); - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsGcsSource message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @static - * @param {google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource} message ImportProductSetsGcsSource - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsGcsSource.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.csvFileUri = ""; - if (message.csvFileUri != null && message.hasOwnProperty("csvFileUri")) - object.csvFileUri = message.csvFileUri; - return object; - }; - - /** - * Converts this ImportProductSetsGcsSource to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsGcsSource.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsGcsSource - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsGcsSource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource"; - }; - - return ImportProductSetsGcsSource; - })(); - - v1p4beta1.ImportProductSetsInputConfig = (function() { - - /** - * Properties of an ImportProductSetsInputConfig. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IImportProductSetsInputConfig - * @property {google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource|null} [gcsSource] ImportProductSetsInputConfig gcsSource - */ - - /** - * Constructs a new ImportProductSetsInputConfig. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImportProductSetsInputConfig. - * @implements IImportProductSetsInputConfig - * @constructor - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig=} [properties] Properties to set - */ - function ImportProductSetsInputConfig(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]]; - } - - /** - * ImportProductSetsInputConfig gcsSource. - * @member {google.cloud.vision.v1p4beta1.IImportProductSetsGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @instance - */ - ImportProductSetsInputConfig.prototype.gcsSource = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ImportProductSetsInputConfig source. - * @member {"gcsSource"|undefined} source - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @instance - */ - Object.defineProperty(ImportProductSetsInputConfig.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ImportProductSetsInputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig} ImportProductSetsInputConfig instance - */ - ImportProductSetsInputConfig.create = function create(properties) { - return new ImportProductSetsInputConfig(properties); - }; - - /** - * Encodes the specified ImportProductSetsInputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig} message ImportProductSetsInputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsInputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) - $root.google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsInputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig} message ImportProductSetsInputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsInputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @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.ImportProductSetsInputConfig} ImportProductSetsInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsInputConfig.decode = function decode(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.ImportProductSetsInputConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.gcsSource = $root.google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsInputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig} ImportProductSetsInputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsInputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsInputConfig message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsInputConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - properties.source = 1; - { - var error = $root.google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - } - return null; - }; - - /** - * Creates an ImportProductSetsInputConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig} ImportProductSetsInputConfig - */ - ImportProductSetsInputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.fromObject(object.gcsSource); - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsInputConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig} message ImportProductSetsInputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsInputConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - object.gcsSource = $root.google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.toObject(message.gcsSource, options); - if (options.oneofs) - object.source = "gcsSource"; - } - return object; - }; - - /** - * Converts this ImportProductSetsInputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsInputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsInputConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig"; - }; - - return ImportProductSetsInputConfig; - })(); - - v1p4beta1.ImportProductSetsRequest = (function() { - - /** - * Properties of an ImportProductSetsRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IImportProductSetsRequest - * @property {string|null} [parent] ImportProductSetsRequest parent - * @property {google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig|null} [inputConfig] ImportProductSetsRequest inputConfig - */ - - /** - * Constructs a new ImportProductSetsRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImportProductSetsRequest. - * @implements IImportProductSetsRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsRequest=} [properties] Properties to set - */ - function ImportProductSetsRequest(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]]; - } - - /** - * ImportProductSetsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @instance - */ - ImportProductSetsRequest.prototype.parent = ""; - - /** - * ImportProductSetsRequest inputConfig. - * @member {google.cloud.vision.v1p4beta1.IImportProductSetsInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @instance - */ - ImportProductSetsRequest.prototype.inputConfig = null; - - /** - * Creates a new ImportProductSetsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsRequest} ImportProductSetsRequest instance - */ - ImportProductSetsRequest.create = function create(properties) { - return new ImportProductSetsRequest(properties); - }; - - /** - * Encodes the specified ImportProductSetsRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsRequest} message ImportProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) - $root.google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsRequest} message ImportProductSetsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @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.ImportProductSetsRequest} ImportProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsRequest.decode = function decode(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.ImportProductSetsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.inputConfig = $root.google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsRequest} ImportProductSetsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - return null; - }; - - /** - * Creates an ImportProductSetsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsRequest} ImportProductSetsRequest - */ - ImportProductSetsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImportProductSetsRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ImportProductSetsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImportProductSetsRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig.fromObject(object.inputConfig); - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.ImportProductSetsRequest} message ImportProductSetsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.inputConfig = 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.v1p4beta1.ImportProductSetsInputConfig.toObject(message.inputConfig, options); - return object; - }; - - /** - * Converts this ImportProductSetsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ImportProductSetsRequest"; - }; - - return ImportProductSetsRequest; - })(); - - v1p4beta1.ImportProductSetsResponse = (function() { - - /** - * Properties of an ImportProductSetsResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IImportProductSetsResponse - * @property {Array.|null} [referenceImages] ImportProductSetsResponse referenceImages - * @property {Array.|null} [statuses] ImportProductSetsResponse statuses - */ - - /** - * Constructs a new ImportProductSetsResponse. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImportProductSetsResponse. - * @implements IImportProductSetsResponse - * @constructor - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsResponse=} [properties] Properties to set - */ - function ImportProductSetsResponse(properties) { - this.referenceImages = []; - this.statuses = []; - 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]]; - } - - /** - * ImportProductSetsResponse referenceImages. - * @member {Array.} referenceImages - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @instance - */ - ImportProductSetsResponse.prototype.referenceImages = $util.emptyArray; - - /** - * ImportProductSetsResponse statuses. - * @member {Array.} statuses - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @instance - */ - ImportProductSetsResponse.prototype.statuses = $util.emptyArray; - - /** - * Creates a new ImportProductSetsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsResponse} ImportProductSetsResponse instance - */ - ImportProductSetsResponse.create = function create(properties) { - return new ImportProductSetsResponse(properties); - }; - - /** - * Encodes the specified ImportProductSetsResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsResponse} message ImportProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.referenceImages != null && message.referenceImages.length) - for (var i = 0; i < message.referenceImages.length; ++i) - $root.google.cloud.vision.v1p4beta1.ReferenceImage.encode(message.referenceImages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.statuses != null && message.statuses.length) - for (var i = 0; i < message.statuses.length; ++i) - $root.google.rpc.Status.encode(message.statuses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportProductSetsResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImportProductSetsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.IImportProductSetsResponse} message ImportProductSetsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportProductSetsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @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.ImportProductSetsResponse} ImportProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsResponse.decode = function decode(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.ImportProductSetsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.referenceImages && message.referenceImages.length)) - message.referenceImages = []; - message.referenceImages.push($root.google.cloud.vision.v1p4beta1.ReferenceImage.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.statuses && message.statuses.length)) - message.statuses = []; - message.statuses.push($root.google.rpc.Status.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportProductSetsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsResponse} ImportProductSetsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportProductSetsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportProductSetsResponse message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportProductSetsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.referenceImages != null && message.hasOwnProperty("referenceImages")) { - if (!Array.isArray(message.referenceImages)) - return "referenceImages: array expected"; - for (var i = 0; i < message.referenceImages.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.ReferenceImage.verify(message.referenceImages[i]); - if (error) - return "referenceImages." + error; - } - } - if (message.statuses != null && message.hasOwnProperty("statuses")) { - if (!Array.isArray(message.statuses)) - return "statuses: array expected"; - for (var i = 0; i < message.statuses.length; ++i) { - var error = $root.google.rpc.Status.verify(message.statuses[i]); - if (error) - return "statuses." + error; - } - } - return null; - }; - - /** - * Creates an ImportProductSetsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImportProductSetsResponse} ImportProductSetsResponse - */ - ImportProductSetsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImportProductSetsResponse) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ImportProductSetsResponse(); - if (object.referenceImages) { - if (!Array.isArray(object.referenceImages)) - throw TypeError(".google.cloud.vision.v1p4beta1.ImportProductSetsResponse.referenceImages: array expected"); - message.referenceImages = []; - for (var i = 0; i < object.referenceImages.length; ++i) { - if (typeof object.referenceImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImportProductSetsResponse.referenceImages: object expected"); - message.referenceImages[i] = $root.google.cloud.vision.v1p4beta1.ReferenceImage.fromObject(object.referenceImages[i]); - } - } - if (object.statuses) { - if (!Array.isArray(object.statuses)) - throw TypeError(".google.cloud.vision.v1p4beta1.ImportProductSetsResponse.statuses: array expected"); - message.statuses = []; - for (var i = 0; i < object.statuses.length; ++i) { - if (typeof object.statuses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImportProductSetsResponse.statuses: object expected"); - message.statuses[i] = $root.google.rpc.Status.fromObject(object.statuses[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ImportProductSetsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @static - * @param {google.cloud.vision.v1p4beta1.ImportProductSetsResponse} message ImportProductSetsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportProductSetsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.referenceImages = []; - object.statuses = []; - } - if (message.referenceImages && message.referenceImages.length) { - object.referenceImages = []; - for (var j = 0; j < message.referenceImages.length; ++j) - object.referenceImages[j] = $root.google.cloud.vision.v1p4beta1.ReferenceImage.toObject(message.referenceImages[j], options); - } - if (message.statuses && message.statuses.length) { - object.statuses = []; - for (var j = 0; j < message.statuses.length; ++j) - object.statuses[j] = $root.google.rpc.Status.toObject(message.statuses[j], options); - } - return object; - }; - - /** - * Converts this ImportProductSetsResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @instance - * @returns {Object.} JSON object - */ - ImportProductSetsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportProductSetsResponse - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ImportProductSetsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportProductSetsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ImportProductSetsResponse"; - }; - - return ImportProductSetsResponse; - })(); - - v1p4beta1.BatchOperationMetadata = (function() { - - /** - * Properties of a BatchOperationMetadata. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchOperationMetadata - * @property {google.cloud.vision.v1p4beta1.BatchOperationMetadata.State|null} [state] BatchOperationMetadata state - * @property {google.protobuf.ITimestamp|null} [submitTime] BatchOperationMetadata submitTime - * @property {google.protobuf.ITimestamp|null} [endTime] BatchOperationMetadata endTime - */ - - /** - * Constructs a new BatchOperationMetadata. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchOperationMetadata. - * @implements IBatchOperationMetadata - * @constructor - * @param {google.cloud.vision.v1p4beta1.IBatchOperationMetadata=} [properties] Properties to set - */ - function BatchOperationMetadata(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]]; - } - - /** - * BatchOperationMetadata state. - * @member {google.cloud.vision.v1p4beta1.BatchOperationMetadata.State} state - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.state = 0; - - /** - * BatchOperationMetadata submitTime. - * @member {google.protobuf.ITimestamp|null|undefined} submitTime - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.submitTime = null; - - /** - * BatchOperationMetadata endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @instance - */ - BatchOperationMetadata.prototype.endTime = null; - - /** - * Creates a new BatchOperationMetadata instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1p4beta1.IBatchOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchOperationMetadata} BatchOperationMetadata instance - */ - BatchOperationMetadata.create = function create(properties) { - return new BatchOperationMetadata(properties); - }; - - /** - * Encodes the specified BatchOperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchOperationMetadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1p4beta1.IBatchOperationMetadata} message BatchOperationMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchOperationMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) - $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BatchOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchOperationMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1p4beta1.IBatchOperationMetadata} message BatchOperationMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @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.BatchOperationMetadata} BatchOperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchOperationMetadata.decode = function decode(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.BatchOperationMetadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.state = reader.int32(); - break; - } - case 2: { - message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchOperationMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.BatchOperationMetadata} BatchOperationMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchOperationMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchOperationMetadata message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BatchOperationMetadata.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.submitTime != null && message.hasOwnProperty("submitTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.submitTime); - if (error) - return "submitTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - return null; - }; - - /** - * Creates a BatchOperationMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BatchOperationMetadata} BatchOperationMetadata - */ - BatchOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchOperationMetadata) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.BatchOperationMetadata(); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "PROCESSING": - case 1: - message.state = 1; - break; - case "SUCCESSFUL": - case 2: - message.state = 2; - break; - case "FAILED": - case 3: - message.state = 3; - break; - case "CANCELLED": - case 4: - message.state = 4; - break; - } - if (object.submitTime != null) { - if (typeof object.submitTime !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.BatchOperationMetadata.submitTime: object expected"); - message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.BatchOperationMetadata.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - return message; - }; - - /** - * Creates a plain object from a BatchOperationMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @static - * @param {google.cloud.vision.v1p4beta1.BatchOperationMetadata} message BatchOperationMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchOperationMetadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.submitTime = null; - object.endTime = null; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.vision.v1p4beta1.BatchOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.vision.v1p4beta1.BatchOperationMetadata.State[message.state] : message.state; - if (message.submitTime != null && message.hasOwnProperty("submitTime")) - object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - return object; - }; - - /** - * Converts this BatchOperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @instance - * @returns {Object.} JSON object - */ - BatchOperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BatchOperationMetadata - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.BatchOperationMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BatchOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.BatchOperationMetadata"; - }; - - /** - * State enum. - * @name google.cloud.vision.v1p4beta1.BatchOperationMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} PROCESSING=1 PROCESSING value - * @property {number} SUCCESSFUL=2 SUCCESSFUL value - * @property {number} FAILED=3 FAILED value - * @property {number} CANCELLED=4 CANCELLED value - */ - BatchOperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PROCESSING"] = 1; - values[valuesById[2] = "SUCCESSFUL"] = 2; - values[valuesById[3] = "FAILED"] = 3; - values[valuesById[4] = "CANCELLED"] = 4; - return values; - })(); - - return BatchOperationMetadata; - })(); - - v1p4beta1.ProductSetPurgeConfig = (function() { - - /** - * Properties of a ProductSetPurgeConfig. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IProductSetPurgeConfig - * @property {string|null} [productSetId] ProductSetPurgeConfig productSetId - */ - - /** - * Constructs a new ProductSetPurgeConfig. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ProductSetPurgeConfig. - * @implements IProductSetPurgeConfig - * @constructor - * @param {google.cloud.vision.v1p4beta1.IProductSetPurgeConfig=} [properties] Properties to set - */ - function ProductSetPurgeConfig(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]]; - } - - /** - * ProductSetPurgeConfig productSetId. - * @member {string} productSetId - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @instance - */ - ProductSetPurgeConfig.prototype.productSetId = ""; - - /** - * Creates a new ProductSetPurgeConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSetPurgeConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ProductSetPurgeConfig} ProductSetPurgeConfig instance - */ - ProductSetPurgeConfig.create = function create(properties) { - return new ProductSetPurgeConfig(properties); - }; - - /** - * Encodes the specified ProductSetPurgeConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSetPurgeConfig} message ProductSetPurgeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSetPurgeConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.productSetId != null && Object.hasOwnProperty.call(message, "productSetId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.productSetId); - return writer; - }; - - /** - * Encodes the specified ProductSetPurgeConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IProductSetPurgeConfig} message ProductSetPurgeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProductSetPurgeConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProductSetPurgeConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @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.ProductSetPurgeConfig} ProductSetPurgeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSetPurgeConfig.decode = function decode(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.ProductSetPurgeConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.productSetId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProductSetPurgeConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ProductSetPurgeConfig} ProductSetPurgeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProductSetPurgeConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProductSetPurgeConfig message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProductSetPurgeConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - if (!$util.isString(message.productSetId)) - return "productSetId: string expected"; - return null; - }; - - /** - * Creates a ProductSetPurgeConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ProductSetPurgeConfig} ProductSetPurgeConfig - */ - ProductSetPurgeConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ProductSetPurgeConfig) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.ProductSetPurgeConfig(); - if (object.productSetId != null) - message.productSetId = String(object.productSetId); - return message; - }; - - /** - * Creates a plain object from a ProductSetPurgeConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @static - * @param {google.cloud.vision.v1p4beta1.ProductSetPurgeConfig} message ProductSetPurgeConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProductSetPurgeConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.productSetId = ""; - if (message.productSetId != null && message.hasOwnProperty("productSetId")) - object.productSetId = message.productSetId; - return object; - }; - - /** - * Converts this ProductSetPurgeConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @instance - * @returns {Object.} JSON object - */ - ProductSetPurgeConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ProductSetPurgeConfig - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.ProductSetPurgeConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ProductSetPurgeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.ProductSetPurgeConfig"; - }; - - return ProductSetPurgeConfig; - })(); - - v1p4beta1.PurgeProductsRequest = (function() { - - /** - * Properties of a PurgeProductsRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IPurgeProductsRequest - * @property {google.cloud.vision.v1p4beta1.IProductSetPurgeConfig|null} [productSetPurgeConfig] PurgeProductsRequest productSetPurgeConfig - * @property {boolean|null} [deleteOrphanProducts] PurgeProductsRequest deleteOrphanProducts - * @property {string|null} [parent] PurgeProductsRequest parent - * @property {boolean|null} [force] PurgeProductsRequest force - */ - - /** - * Constructs a new PurgeProductsRequest. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a PurgeProductsRequest. - * @implements IPurgeProductsRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IPurgeProductsRequest=} [properties] Properties to set - */ - function PurgeProductsRequest(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]]; - } - - /** - * PurgeProductsRequest productSetPurgeConfig. - * @member {google.cloud.vision.v1p4beta1.IProductSetPurgeConfig|null|undefined} productSetPurgeConfig - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @instance - */ - PurgeProductsRequest.prototype.productSetPurgeConfig = null; - - /** - * PurgeProductsRequest deleteOrphanProducts. - * @member {boolean|null|undefined} deleteOrphanProducts - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @instance - */ - PurgeProductsRequest.prototype.deleteOrphanProducts = null; - - /** - * PurgeProductsRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @instance - */ - PurgeProductsRequest.prototype.parent = ""; - - /** - * PurgeProductsRequest force. - * @member {boolean} force - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @instance - */ - PurgeProductsRequest.prototype.force = false; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * PurgeProductsRequest target. - * @member {"productSetPurgeConfig"|"deleteOrphanProducts"|undefined} target - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @instance - */ - Object.defineProperty(PurgeProductsRequest.prototype, "target", { - get: $util.oneOfGetter($oneOfFields = ["productSetPurgeConfig", "deleteOrphanProducts"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PurgeProductsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IPurgeProductsRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.PurgeProductsRequest} PurgeProductsRequest instance - */ - PurgeProductsRequest.create = function create(properties) { - return new PurgeProductsRequest(properties); - }; - - /** - * Encodes the specified PurgeProductsRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.PurgeProductsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IPurgeProductsRequest} message PurgeProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeProductsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.productSetPurgeConfig != null && Object.hasOwnProperty.call(message, "productSetPurgeConfig")) - $root.google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.encode(message.productSetPurgeConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.deleteOrphanProducts != null && Object.hasOwnProperty.call(message, "deleteOrphanProducts")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deleteOrphanProducts); - if (message.force != null && Object.hasOwnProperty.call(message, "force")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.force); - return writer; - }; - - /** - * Encodes the specified PurgeProductsRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.PurgeProductsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.IPurgeProductsRequest} message PurgeProductsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PurgeProductsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PurgeProductsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @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.PurgeProductsRequest} PurgeProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeProductsRequest.decode = function decode(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.PurgeProductsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - message.productSetPurgeConfig = $root.google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.decode(reader, reader.uint32()); - break; - } - case 3: { - message.deleteOrphanProducts = reader.bool(); - break; - } - case 1: { - message.parent = reader.string(); - break; - } - case 4: { - message.force = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PurgeProductsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.PurgeProductsRequest} PurgeProductsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PurgeProductsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PurgeProductsRequest message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PurgeProductsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.productSetPurgeConfig != null && message.hasOwnProperty("productSetPurgeConfig")) { - properties.target = 1; - { - var error = $root.google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.verify(message.productSetPurgeConfig); - if (error) - return "productSetPurgeConfig." + error; - } - } - if (message.deleteOrphanProducts != null && message.hasOwnProperty("deleteOrphanProducts")) { - if (properties.target === 1) - return "target: multiple values"; - properties.target = 1; - if (typeof message.deleteOrphanProducts !== "boolean") - return "deleteOrphanProducts: boolean expected"; - } - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.force != null && message.hasOwnProperty("force")) - if (typeof message.force !== "boolean") - return "force: boolean expected"; - return null; - }; - - /** - * Creates a PurgeProductsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.PurgeProductsRequest} PurgeProductsRequest - */ - PurgeProductsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.PurgeProductsRequest) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.PurgeProductsRequest(); - if (object.productSetPurgeConfig != null) { - if (typeof object.productSetPurgeConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.PurgeProductsRequest.productSetPurgeConfig: object expected"); - message.productSetPurgeConfig = $root.google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.fromObject(object.productSetPurgeConfig); - } - if (object.deleteOrphanProducts != null) - message.deleteOrphanProducts = Boolean(object.deleteOrphanProducts); - if (object.parent != null) - message.parent = String(object.parent); - if (object.force != null) - message.force = Boolean(object.force); - return message; - }; - - /** - * Creates a plain object from a PurgeProductsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @static - * @param {google.cloud.vision.v1p4beta1.PurgeProductsRequest} message PurgeProductsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PurgeProductsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.force = false; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.productSetPurgeConfig != null && message.hasOwnProperty("productSetPurgeConfig")) { - object.productSetPurgeConfig = $root.google.cloud.vision.v1p4beta1.ProductSetPurgeConfig.toObject(message.productSetPurgeConfig, options); - if (options.oneofs) - object.target = "productSetPurgeConfig"; - } - if (message.deleteOrphanProducts != null && message.hasOwnProperty("deleteOrphanProducts")) { - object.deleteOrphanProducts = message.deleteOrphanProducts; - if (options.oneofs) - object.target = "deleteOrphanProducts"; - } - if (message.force != null && message.hasOwnProperty("force")) - object.force = message.force; - return object; - }; - - /** - * Converts this PurgeProductsRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @instance - * @returns {Object.} JSON object - */ - PurgeProductsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PurgeProductsRequest - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.PurgeProductsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PurgeProductsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.PurgeProductsRequest"; - }; - - return PurgeProductsRequest; - })(); - - v1p4beta1.TextAnnotation = (function() { - - /** - * Properties of a TextAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ITextAnnotation - * @property {Array.|null} [pages] TextAnnotation pages - * @property {string|null} [text] TextAnnotation text - */ - - /** - * Constructs a new TextAnnotation. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a TextAnnotation. - * @implements ITextAnnotation - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.pages = $util.emptyArray; - - /** - * TextAnnotation text. - * @member {string} text - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.text = ""; - - /** - * Creates a new TextAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.ITextAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.TextAnnotation} TextAnnotation instance - */ - TextAnnotation.create = function create(properties) { - return new TextAnnotation(properties); - }; - - /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "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.v1p4beta1.TextAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.TextAnnotation} TextAnnotation - */ - TextAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.TextAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.TextAnnotation(); - if (object.pages) { - if (!Array.isArray(object.pages)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.pages: object expected"); - message.pages[i] = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation - * @instance - * @returns {Object.} JSON object - */ - TextAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextAnnotation - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.TextAnnotation"; - }; - - TextAnnotation.DetectedLanguage = (function() { - - /** - * Properties of a DetectedLanguage. - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @interface IDetectedLanguage - * @property {string|null} [languageCode] DetectedLanguage languageCode - * @property {number|null} [confidence] DetectedLanguage confidence - */ - - /** - * Constructs a new DetectedLanguage. - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @classdesc Represents a DetectedLanguage. - * @implements IDetectedLanguage - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.languageCode = ""; - - /** - * DetectedLanguage confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.confidence = 0; - - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p4beta1.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 && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p4beta1.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(); - }; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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; - }; - - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.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()); - }; - - /** - * Verifies a DetectedLanguage message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.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; - }; - - /** - * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage} DetectedLanguage - */ - DetectedLanguage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage(); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; - - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p4beta1.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; - return object; - }; - - /** - * Converts this DetectedLanguage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @instance - * @returns {Object.} JSON object - */ - DetectedLanguage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DetectedLanguage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage"; - }; - - return DetectedLanguage; - })(); - - TextAnnotation.DetectedBreak = (function() { - - /** - * Properties of a DetectedBreak. - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @interface IDetectedBreak - * @property {google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.BreakType|null} [type] DetectedBreak type - * @property {boolean|null} [isPrefix] DetectedBreak isPrefix - */ - - /** - * Constructs a new DetectedBreak. - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @classdesc Represents a DetectedBreak. - * @implements IDetectedBreak - * @constructor - * @param {google.cloud.vision.v1p4beta1.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]]; - } - - /** - * DetectedBreak type. - * @member {google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.BreakType} type - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.type = 0; - - /** - * DetectedBreak isPrefix. - * @member {boolean} isPrefix - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.isPrefix = false; - - /** - * Creates a new DetectedBreak instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak} DetectedBreak instance - */ - DetectedBreak.create = function create(properties) { - return new DetectedBreak(properties); - }; - - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p4beta1.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 && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.isPrefix != null && Object.hasOwnProperty.call(message, "isPrefix")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isPrefix); - return writer; - }; - - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p4beta1.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(); - }; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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; - }; - - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedBreak - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak} DetectedBreak - */ - DetectedBreak.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - 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.v1p4beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedBreak.BreakType[message.type] === undefined ? message.type : $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedBreak - * @instance - * @returns {Object.} JSON object - */ - DetectedBreak.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DetectedBreak - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DetectedBreak.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak"; - }; - - /** - * BreakType enum. - * @name google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.BreakType - * @enum {number} - * @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.v1p4beta1.TextAnnotation - * @interface ITextProperty - * @property {Array.|null} [detectedLanguages] TextProperty detectedLanguages - * @property {google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak|null} [detectedBreak] TextProperty detectedBreak - */ - - /** - * Constructs a new TextProperty. - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation - * @classdesc Represents a TextProperty. - * @implements ITextProperty - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedLanguages = $util.emptyArray; - - /** - * TextProperty detectedBreak. - * @member {google.cloud.vision.v1p4beta1.TextAnnotation.IDetectedBreak|null|undefined} detectedBreak - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedBreak = null; - - /** - * Creates a new TextProperty instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.detectedBreak != null && Object.hasOwnProperty.call(message, "detectedBreak")) - $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedLanguage.decode(reader, reader.uint32())); - break; - } - case 2: { - message.detectedBreak = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedLanguage.verify(message.detectedLanguages[i]); - if (error) - return "detectedLanguages." + error; - } - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { - var error = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty} TextProperty - */ - TextProperty.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty(); - if (object.detectedLanguages) { - if (!Array.isArray(object.detectedLanguages)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.detectedLanguages: object expected"); - message.detectedLanguages[i] = $root.google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage.fromObject(object.detectedLanguages[i]); - } - } - if (object.detectedBreak != null) { - if (typeof object.detectedBreak !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.detectedBreak: object expected"); - message.detectedBreak = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.DetectedLanguage.toObject(message.detectedLanguages[j], options); - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) - object.detectedBreak = $root.google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak.toObject(message.detectedBreak, options); - return object; - }; - - /** - * Converts this TextProperty to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty - * @instance - * @returns {Object.} JSON object - */ - TextProperty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TextProperty - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TextProperty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty"; - }; - - return TextProperty; - })(); - - return TextAnnotation; - })(); - - v1p4beta1.Page = (function() { - - /** - * Properties of a Page. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IPage - * @property {google.cloud.vision.v1p4beta1.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.v1p4beta1 - * @classdesc Represents a Page. - * @implements IPage - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p4beta1.Page - * @instance - */ - Page.prototype.property = null; - - /** - * Page width. - * @member {number} width - * @memberof google.cloud.vision.v1p4beta1.Page - * @instance - */ - Page.prototype.width = 0; - - /** - * Page height. - * @member {number} height - * @memberof google.cloud.vision.v1p4beta1.Page - * @instance - */ - Page.prototype.height = 0; - - /** - * Page blocks. - * @member {Array.} blocks - * @memberof google.cloud.vision.v1p4beta1.Page - * @instance - */ - Page.prototype.blocks = $util.emptyArray; - - /** - * Page confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.Page - * @instance - */ - Page.prototype.confidence = 0; - - /** - * Creates a new Page instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Page - * @static - * @param {google.cloud.vision.v1p4beta1.IPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Page} Page instance - */ - Page.create = function create(properties) { - return new Page(properties); - }; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Page.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Page - * @static - * @param {google.cloud.vision.v1p4beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.width != null && Object.hasOwnProperty.call(message, "width")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.width); - if (message.height != null && Object.hasOwnProperty.call(message, "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.v1p4beta1.Block.encode(message.blocks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p4beta1.Page.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Page - * @static - * @param {google.cloud.vision.v1p4beta1.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(); - }; - - /** - * Decodes a Page message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.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.v1p4beta1.Page} Page - * @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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.Page(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Block.decode(reader, reader.uint32())); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Page message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Page - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Page} Page - * @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) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Page message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.Page - * @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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + 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.v1p4beta1.Block.verify(message.blocks[i]); - if (error) - return "blocks." + 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. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Page - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Page} Page - */ - Page.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Page) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Page(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Page.property: object expected"); - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - 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.v1p4beta1.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.v1p4beta1.Page.blocks: object expected"); - message.blocks[i] = $root.google.cloud.vision.v1p4beta1.Block.fromObject(object.blocks[i]); - } - } - 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. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Page - * @static - * @param {google.cloud.vision.v1p4beta1.Page} message Page - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - 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.width = 0; - object.height = 0; - object.confidence = 0; - } - if (message.property != null && message.hasOwnProperty("property")) - object.property = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.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 Page to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Page - * @instance - * @returns {Object.} JSON object - */ - Page.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Page - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Page - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Page.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Page"; - }; - - return Page; - })(); - - v1p4beta1.Block = (function() { - - /** - * Properties of a Block. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IBlock - * @property {google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null} [property] Block property - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingBox] Block boundingBox - * @property {Array.|null} [paragraphs] Block paragraphs - * @property {google.cloud.vision.v1p4beta1.Block.BlockType|null} [blockType] Block blockType - * @property {number|null} [confidence] Block confidence - */ - - /** - * Constructs a new Block. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Block. - * @implements IBlock - * @constructor - * @param {google.cloud.vision.v1p4beta1.IBlock=} [properties] Properties to set - */ - function Block(properties) { - this.paragraphs = []; - 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]]; - } - - /** - * Block property. - * @member {google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p4beta1.Block - * @instance - */ - Block.prototype.property = null; - - /** - * Block boundingBox. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p4beta1.Block - * @instance - */ - Block.prototype.boundingBox = null; - - /** - * Block paragraphs. - * @member {Array.} paragraphs - * @memberof google.cloud.vision.v1p4beta1.Block - * @instance - */ - Block.prototype.paragraphs = $util.emptyArray; - - /** - * Block blockType. - * @member {google.cloud.vision.v1p4beta1.Block.BlockType} blockType - * @memberof google.cloud.vision.v1p4beta1.Block - * @instance - */ - Block.prototype.blockType = 0; - - /** - * Block confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.Block - * @instance - */ - Block.prototype.confidence = 0; - - /** - * Creates a new Block instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Block - * @static - * @param {google.cloud.vision.v1p4beta1.IBlock=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Block} Block instance - */ - Block.create = function create(properties) { - return new Block(properties); - }; - - /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Block.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Block - * @static - * @param {google.cloud.vision.v1p4beta1.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.property != null && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.blockType != null && Object.hasOwnProperty.call(message, "blockType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.blockType); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Block.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Block - * @static - * @param {google.cloud.vision.v1p4beta1.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Block message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.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.v1p4beta1.Block} Block - * @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) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.Block(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.vision.v1p4beta1.Paragraph.decode(reader, reader.uint32())); - break; - } - case 4: { - message.blockType = reader.int32(); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Block - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Block} Block - * @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) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Block message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.Block - * @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) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Paragraph.verify(message.paragraphs[i]); - if (error) - return "paragraphs." + 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 Block message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Block - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Block} Block - */ - Block.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Block) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Block(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Block.property: object expected"); - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Block.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.paragraphs) { - if (!Array.isArray(object.paragraphs)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.Block.paragraphs: object expected"); - message.paragraphs[i] = $root.google.cloud.vision.v1p4beta1.Paragraph.fromObject(object.paragraphs[i]); - } - } - switch (object.blockType) { - default: - if (typeof object.blockType === "number") { - message.blockType = object.blockType; - break; - } - break; - 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 Block message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Block - * @static - * @param {google.cloud.vision.v1p4beta1.Block} message Block - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Block.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.v1p4beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Paragraph.toObject(message.paragraphs[j], options); - } - if (message.blockType != null && message.hasOwnProperty("blockType")) - object.blockType = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Block.BlockType[message.blockType] === undefined ? message.blockType : $root.google.cloud.vision.v1p4beta1.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 Block to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Block - * @instance - * @returns {Object.} JSON object - */ - Block.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Block - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Block - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Block.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Block"; - }; - - /** - * BlockType enum. - * @name google.cloud.vision.v1p4beta1.Block.BlockType - * @enum {number} - * @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; - })(); - - return Block; - })(); - - v1p4beta1.Paragraph = (function() { - - /** - * Properties of a Paragraph. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IParagraph - * @property {google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null} [property] Paragraph property - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingBox] Paragraph boundingBox - * @property {Array.|null} [words] Paragraph words - * @property {number|null} [confidence] Paragraph confidence - */ - - /** - * Constructs a new Paragraph. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Paragraph. - * @implements IParagraph - * @constructor - * @param {google.cloud.vision.v1p4beta1.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]]; - } - - /** - * Paragraph property. - * @member {google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p4beta1.Paragraph - * @instance - */ - Paragraph.prototype.property = null; - - /** - * Paragraph boundingBox. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p4beta1.Paragraph - * @instance - */ - Paragraph.prototype.boundingBox = null; - - /** - * Paragraph words. - * @member {Array.} words - * @memberof google.cloud.vision.v1p4beta1.Paragraph - * @instance - */ - Paragraph.prototype.words = $util.emptyArray; - - /** - * Paragraph confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.Paragraph - * @instance - */ - Paragraph.prototype.confidence = 0; - - /** - * Creates a new Paragraph instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p4beta1.IParagraph=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Paragraph} Paragraph instance - */ - Paragraph.create = function create(properties) { - return new Paragraph(properties); - }; - - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Paragraph.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p4beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Word.encode(message.words[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p4beta1.Paragraph.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Paragraph(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.words && message.words.length)) - message.words = []; - message.words.push($root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Paragraph - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Paragraph - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Paragraph} Paragraph - */ - Paragraph.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Paragraph) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Paragraph(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Paragraph.property: object expected"); - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Paragraph.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.words) { - if (!Array.isArray(object.words)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.Paragraph.words: object expected"); - message.words[i] = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Paragraph - * @instance - * @returns {Object.} JSON object - */ - Paragraph.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Paragraph - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Paragraph - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Paragraph.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Paragraph"; - }; - - return Paragraph; - })(); - - v1p4beta1.Word = (function() { - - /** - * Properties of a Word. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IWord - * @property {google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null} [property] Word property - * @property {google.cloud.vision.v1p4beta1.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.v1p4beta1 - * @classdesc Represents a Word. - * @implements IWord - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p4beta1.Word - * @instance - */ - Word.prototype.property = null; - - /** - * Word boundingBox. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p4beta1.Word - * @instance - */ - Word.prototype.boundingBox = null; - - /** - * Word symbols. - * @member {Array.} symbols - * @memberof google.cloud.vision.v1p4beta1.Word - * @instance - */ - Word.prototype.symbols = $util.emptyArray; - - /** - * Word confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.Word - * @instance - */ - Word.prototype.confidence = 0; - - /** - * Creates a new Word instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Word - * @static - * @param {google.cloud.vision.v1p4beta1.IWord=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Word} Word instance - */ - Word.create = function create(properties) { - return new Word(properties); - }; - - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Word.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Word - * @static - * @param {google.cloud.vision.v1p4beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Symbol.encode(message.symbols[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p4beta1.Word.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Word - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Word(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.symbols && message.symbols.length)) - message.symbols = []; - message.symbols.push($root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Word - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Word - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Word} Word - */ - Word.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Word) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Word(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Word.property: object expected"); - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Word.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.symbols) { - if (!Array.isArray(object.symbols)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.Word.symbols: object expected"); - message.symbols[i] = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Word - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Word - * @instance - * @returns {Object.} JSON object - */ - Word.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Word - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Word - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Word.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Word"; - }; - - return Word; - })(); - - v1p4beta1.Symbol = (function() { - - /** - * Properties of a Symbol. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ISymbol - * @property {google.cloud.vision.v1p4beta1.TextAnnotation.ITextProperty|null} [property] Symbol property - * @property {google.cloud.vision.v1p4beta1.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.v1p4beta1 - * @classdesc Represents a Symbol. - * @implements ISymbol - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p4beta1.Symbol - * @instance - */ - Symbol.prototype.property = null; - - /** - * Symbol boundingBox. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p4beta1.Symbol - * @instance - */ - Symbol.prototype.boundingBox = null; - - /** - * Symbol text. - * @member {string} text - * @memberof google.cloud.vision.v1p4beta1.Symbol - * @instance - */ - Symbol.prototype.text = ""; - - /** - * Symbol confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.Symbol - * @instance - */ - Symbol.prototype.confidence = 0; - - /** - * Creates a new Symbol instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.Symbol - * @static - * @param {google.cloud.vision.v1p4beta1.ISymbol=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Symbol} Symbol instance - */ - Symbol.create = function create(properties) { - return new Symbol(properties); - }; - - /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Symbol.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.Symbol - * @static - * @param {google.cloud.vision.v1p4beta1.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 && Object.hasOwnProperty.call(message, "property")) - $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && Object.hasOwnProperty.call(message, "boundingBox")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.text != null && Object.hasOwnProperty.call(message, "text")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.text); - if (message.confidence != null && Object.hasOwnProperty.call(message, "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.v1p4beta1.Symbol.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Symbol - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.Symbol(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - } - case 2: { - message.boundingBox = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Symbol - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Symbol - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Symbol} Symbol - */ - Symbol.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Symbol) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Symbol(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Symbol.property: object expected"); - message.property = $root.google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Symbol.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Symbol - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.Symbol - * @instance - * @returns {Object.} JSON object - */ - Symbol.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Symbol - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.Symbol - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Symbol.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.Symbol"; - }; - - return Symbol; - })(); - - v1p4beta1.WebDetection = (function() { - - /** - * Properties of a WebDetection. - * @memberof google.cloud.vision.v1p4beta1 - * @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.v1p4beta1 - * @classdesc Represents a WebDetection. - * @implements IWebDetection - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection - * @instance - */ - WebDetection.prototype.webEntities = $util.emptyArray; - - /** - * WebDetection fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @instance - */ - WebDetection.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebDetection partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @instance - */ - WebDetection.prototype.partialMatchingImages = $util.emptyArray; - - /** - * WebDetection pagesWithMatchingImages. - * @member {Array.} pagesWithMatchingImages - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @instance - */ - WebDetection.prototype.pagesWithMatchingImages = $util.emptyArray; - - /** - * WebDetection visuallySimilarImages. - * @member {Array.} visuallySimilarImages - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @instance - */ - WebDetection.prototype.visuallySimilarImages = $util.emptyArray; - - /** - * WebDetection bestGuessLabels. - * @member {Array.} bestGuessLabels - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @instance - */ - WebDetection.prototype.bestGuessLabels = $util.emptyArray; - - /** - * Creates a new WebDetection instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p4beta1.IWebDetection=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.WebDetection} WebDetection instance - */ - WebDetection.create = function create(properties) { - return new WebDetection(properties); - }; - - /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.WebDetection.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.WebDetection.WebEntity.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 4: { - if (!(message.pagesWithMatchingImages && message.pagesWithMatchingImages.length)) - message.pagesWithMatchingImages = []; - message.pagesWithMatchingImages.push($root.google.cloud.vision.v1p4beta1.WebDetection.WebPage.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.visuallySimilarImages && message.visuallySimilarImages.length)) - message.visuallySimilarImages = []; - message.visuallySimilarImages.push($root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 8: { - if (!(message.bestGuessLabels && message.bestGuessLabels.length)) - message.bestGuessLabels = []; - message.bestGuessLabels.push($root.google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.WebDetection - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.WebDetection} WebDetection - */ - WebDetection.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.WebDetection) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.WebDetection(); - if (object.webEntities) { - if (!Array.isArray(object.webEntities)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.webEntities: object expected"); - message.webEntities[i] = $root.google.cloud.vision.v1p4beta1.WebDetection.WebEntity.fromObject(object.webEntities[i]); - } - } - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - if (object.pagesWithMatchingImages) { - if (!Array.isArray(object.pagesWithMatchingImages)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.pagesWithMatchingImages: object expected"); - message.pagesWithMatchingImages[i] = $root.google.cloud.vision.v1p4beta1.WebDetection.WebPage.fromObject(object.pagesWithMatchingImages[i]); - } - } - if (object.visuallySimilarImages) { - if (!Array.isArray(object.visuallySimilarImages)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.visuallySimilarImages: object expected"); - message.visuallySimilarImages[i] = $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.fromObject(object.visuallySimilarImages[i]); - } - } - if (object.bestGuessLabels) { - if (!Array.isArray(object.bestGuessLabels)) - throw TypeError(".google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.bestGuessLabels: object expected"); - message.bestGuessLabels[i] = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection - * @static - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.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.v1p4beta1.WebDetection.WebLabel.toObject(message.bestGuessLabels[j], options); - } - return object; - }; - - /** - * Converts this WebDetection to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @instance - * @returns {Object.} JSON object - */ - WebDetection.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebDetection - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebDetection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.WebDetection"; - }; - - WebDetection.WebEntity = (function() { - - /** - * Properties of a WebEntity. - * @memberof google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection - * @classdesc Represents a WebEntity. - * @implements IWebEntity - * @constructor - * @param {google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.entityId = ""; - - /** - * WebEntity score. - * @member {number} score - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.score = 0; - - /** - * WebEntity description. - * @member {string} description - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.description = ""; - - /** - * Creates a new WebEntity instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebEntity=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.WebEntity.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p4beta1.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 && Object.hasOwnProperty.call(message, "entityId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.entityId); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - return writer; - }; - - /** - * Encodes the specified WebEntity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebEntity.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebEntity} message WebEntity message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebEntity.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @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.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decode = function decode(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.WebDetection.WebEntity(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.entityId = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.description = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebEntity message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebEntity} WebEntity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebEntity.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebEntity message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebEntity.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.entityId != null && message.hasOwnProperty("entityId")) - if (!$util.isString(message.entityId)) - return "entityId: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - return null; - }; - - /** - * Creates a WebEntity message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebEntity} WebEntity - */ - WebEntity.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.WebDetection.WebEntity) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.WebDetection.WebEntity(); - if (object.entityId != null) - message.entityId = String(object.entityId); - if (object.score != null) - message.score = Number(object.score); - if (object.description != null) - message.description = String(object.description); - return message; - }; - - /** - * Creates a plain object from a WebEntity message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.WebEntity} message WebEntity - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebEntity.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.entityId = ""; - object.score = 0; - object.description = ""; - } - if (message.entityId != null && message.hasOwnProperty("entityId")) - object.entityId = message.entityId; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - return object; - }; - - /** - * Converts this WebEntity to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @instance - * @returns {Object.} JSON object - */ - WebEntity.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebEntity - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebEntity - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebEntity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.WebDetection.WebEntity"; - }; - - return WebEntity; - })(); - - WebDetection.WebImage = (function() { - - /** - * Properties of a WebImage. - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @interface IWebImage - * @property {string|null} [url] WebImage url - * @property {number|null} [score] WebImage score - */ - - /** - * Constructs a new WebImage. - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @classdesc Represents a WebImage. - * @implements IWebImage - * @constructor - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebImage=} [properties] Properties to set - */ - function WebImage(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]]; - } - - /** - * WebImage url. - * @member {string} url - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.url = ""; - - /** - * WebImage score. - * @member {number} score - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @instance - */ - WebImage.prototype.score = 0; - - /** - * Creates a new WebImage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebImage} WebImage instance - */ - WebImage.create = function create(properties) { - return new WebImage(properties); - }; - - /** - * Encodes the specified WebImage message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebImage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - return writer; - }; - - /** - * Encodes the specified WebImage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebImage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebImage} message WebImage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebImage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebImage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @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.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decode = function decode(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.WebDetection.WebImage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebImage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebImage} WebImage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebImage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebImage message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebImage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - return null; - }; - - /** - * Creates a WebImage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebImage} WebImage - */ - WebImage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - return message; - }; - - /** - * Creates a plain object from a WebImage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.WebImage} message WebImage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebImage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.url = ""; - object.score = 0; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - return object; - }; - - /** - * Converts this WebImage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @instance - * @returns {Object.} JSON object - */ - WebImage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebImage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebImage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebImage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.WebDetection.WebImage"; - }; - - return WebImage; - })(); - - WebDetection.WebPage = (function() { - - /** - * Properties of a WebPage. - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @interface IWebPage - * @property {string|null} [url] WebPage url - * @property {number|null} [score] WebPage score - * @property {string|null} [pageTitle] WebPage pageTitle - * @property {Array.|null} [fullMatchingImages] WebPage fullMatchingImages - * @property {Array.|null} [partialMatchingImages] WebPage partialMatchingImages - */ - - /** - * Constructs a new WebPage. - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @classdesc Represents a WebPage. - * @implements IWebPage - * @constructor - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebPage=} [properties] Properties to set - */ - function WebPage(properties) { - this.fullMatchingImages = []; - this.partialMatchingImages = []; - 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]]; - } - - /** - * WebPage url. - * @member {string} url - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.url = ""; - - /** - * WebPage score. - * @member {number} score - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.score = 0; - - /** - * WebPage pageTitle. - * @member {string} pageTitle - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.pageTitle = ""; - - /** - * WebPage fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.fullMatchingImages = $util.emptyArray; - - /** - * WebPage partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @instance - */ - WebPage.prototype.partialMatchingImages = $util.emptyArray; - - /** - * Creates a new WebPage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebPage} WebPage instance - */ - WebPage.create = function create(properties) { - return new WebPage(properties); - }; - - /** - * Encodes the specified WebPage message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebPage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.url != null && Object.hasOwnProperty.call(message, "url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); - if (message.score != null && Object.hasOwnProperty.call(message, "score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pageTitle != null && Object.hasOwnProperty.call(message, "pageTitle")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageTitle); - if (message.fullMatchingImages != null && message.fullMatchingImages.length) - for (var i = 0; i < message.fullMatchingImages.length; ++i) - $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.encode(message.fullMatchingImages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.partialMatchingImages != null && message.partialMatchingImages.length) - for (var i = 0; i < message.partialMatchingImages.length; ++i) - $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.encode(message.partialMatchingImages[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified WebPage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebPage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebPage} message WebPage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebPage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebPage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @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.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decode = function decode(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.WebDetection.WebPage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.url = reader.string(); - break; - } - case 2: { - message.score = reader.float(); - break; - } - case 3: { - message.pageTitle = reader.string(); - break; - } - case 4: { - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebPage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebPage} WebPage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebPage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebPage message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebPage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.url != null && message.hasOwnProperty("url")) - if (!$util.isString(message.url)) - return "url: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - if (!$util.isString(message.pageTitle)) - return "pageTitle: string expected"; - 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.v1p4beta1.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.v1p4beta1.WebDetection.WebImage.verify(message.partialMatchingImages[i]); - if (error) - return "partialMatchingImages." + error; - } - } - return null; - }; - - /** - * Creates a WebPage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebPage} WebPage - */ - WebPage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.WebDetection.WebPage) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.WebDetection.WebPage(); - if (object.url != null) - message.url = String(object.url); - if (object.score != null) - message.score = Number(object.score); - if (object.pageTitle != null) - message.pageTitle = String(object.pageTitle); - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1p4beta1.WebDetection.WebPage.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.v1p4beta1.WebDetection.WebPage.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1p4beta1.WebDetection.WebPage.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.v1p4beta1.WebDetection.WebPage.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1p4beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a WebPage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.WebPage} message WebPage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebPage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.fullMatchingImages = []; - object.partialMatchingImages = []; - } - if (options.defaults) { - object.url = ""; - object.score = 0; - object.pageTitle = ""; - } - if (message.url != null && message.hasOwnProperty("url")) - object.url = message.url; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pageTitle != null && message.hasOwnProperty("pageTitle")) - object.pageTitle = message.pageTitle; - if (message.fullMatchingImages && message.fullMatchingImages.length) { - object.fullMatchingImages = []; - for (var j = 0; j < message.fullMatchingImages.length; ++j) - object.fullMatchingImages[j] = $root.google.cloud.vision.v1p4beta1.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.v1p4beta1.WebDetection.WebImage.toObject(message.partialMatchingImages[j], options); - } - return object; - }; - - /** - * Converts this WebPage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @instance - * @returns {Object.} JSON object - */ - WebPage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebPage - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebPage - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebPage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.WebDetection.WebPage"; - }; - - return WebPage; - })(); - - WebDetection.WebLabel = (function() { - - /** - * Properties of a WebLabel. - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @interface IWebLabel - * @property {string|null} [label] WebLabel label - * @property {string|null} [languageCode] WebLabel languageCode - */ - - /** - * Constructs a new WebLabel. - * @memberof google.cloud.vision.v1p4beta1.WebDetection - * @classdesc Represents a WebLabel. - * @implements IWebLabel - * @constructor - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebLabel=} [properties] Properties to set - */ - function WebLabel(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]]; - } - - /** - * WebLabel label. - * @member {string} label - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.label = ""; - - /** - * WebLabel languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @instance - */ - WebLabel.prototype.languageCode = ""; - - /** - * Creates a new WebLabel instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebLabel=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebLabel} WebLabel instance - */ - WebLabel.create = function create(properties) { - return new WebLabel(properties); - }; - - /** - * Encodes the specified WebLabel message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebLabel.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.label); - if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - return writer; - }; - - /** - * Encodes the specified WebLabel message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetection.WebLabel.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.IWebLabel} message WebLabel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebLabel.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @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.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decode = function decode(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.WebDetection.WebLabel(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.label = reader.string(); - break; - } - case 2: { - message.languageCode = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WebLabel message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebLabel} WebLabel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WebLabel.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WebLabel message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WebLabel.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.label != null && message.hasOwnProperty("label")) - if (!$util.isString(message.label)) - return "label: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - return null; - }; - - /** - * Creates a WebLabel message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.WebDetection.WebLabel} WebLabel - */ - WebLabel.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.WebDetection.WebLabel) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.WebDetection.WebLabel(); - if (object.label != null) - message.label = String(object.label); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - return message; - }; - - /** - * Creates a plain object from a WebLabel message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @static - * @param {google.cloud.vision.v1p4beta1.WebDetection.WebLabel} message WebLabel - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WebLabel.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - 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; - }; - - /** - * Converts this WebLabel to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @instance - * @returns {Object.} JSON object - */ - WebLabel.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WebLabel - * @function getTypeUrl - * @memberof google.cloud.vision.v1p4beta1.WebDetection.WebLabel - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WebLabel.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.vision.v1p4beta1.WebDetection.WebLabel"; - }; - - return WebLabel; - })(); - - return WebDetection; - })(); - - return v1p4beta1; - })(); - - return vision; - })(); - - return cloud; - })(); - - google.api = (function() { - - /** - * Namespace api. - * @memberof google - * @namespace - */ - var api = {}; - - api.Http = (function() { - - /** - * Properties of a Http. - * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion - */ - - /** - * Constructs a new Http. - * @memberof google.api - * @classdesc Represents a Http. - * @implements IHttp - * @constructor - * @param {google.api.IHttp=} [properties] Properties to set - */ - function Http(properties) { - this.rules = []; - 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]]; - } - - /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http - * @instance - */ - Http.prototype.rules = $util.emptyArray; - - /** - * Http fullyDecodeReservedExpansion. - * @member {boolean} fullyDecodeReservedExpansion - * @memberof google.api.Http - * @instance - */ - Http.prototype.fullyDecodeReservedExpansion = false; - - /** - * Creates a new Http instance using the specified properties. - * @function create - * @memberof google.api.Http - * @static - * @param {google.api.IHttp=} [properties] Properties to set - * @returns {google.api.Http} Http instance - */ - Http.create = function create(properties) { - return new Http(properties); - }; - - /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encode - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rules != null && message.rules.length) - for (var i = 0; i < message.rules.length; ++i) - $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); - return writer; - }; - - /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Http message from the specified reader or buffer. - * @function decode - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - } - case 2: { - message.fullyDecodeReservedExpansion = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Http message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Http message. - * @function verify - * @memberof google.api.Http - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Http.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rules != null && message.hasOwnProperty("rules")) { - if (!Array.isArray(message.rules)) - return "rules: array expected"; - for (var i = 0; i < message.rules.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.rules[i]); - if (error) - return "rules." + error; - } - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - if (typeof message.fullyDecodeReservedExpansion !== "boolean") - return "fullyDecodeReservedExpansion: boolean expected"; - return null; - }; - - /** - * Creates a Http message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.Http - * @static - * @param {Object.} object Plain object - * @returns {google.api.Http} Http - */ - Http.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Http) - return object; - var message = new $root.google.api.Http(); - if (object.rules) { - if (!Array.isArray(object.rules)) - throw TypeError(".google.api.Http.rules: array expected"); - message.rules = []; - for (var i = 0; i < object.rules.length; ++i) { - if (typeof object.rules[i] !== "object") - throw TypeError(".google.api.Http.rules: object expected"); - message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); - } - } - if (object.fullyDecodeReservedExpansion != null) - message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); - return message; - }; - - /** - * Creates a plain object from a Http message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.Http - * @static - * @param {google.api.Http} message Http - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Http.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.rules = []; - if (options.defaults) - object.fullyDecodeReservedExpansion = false; - if (message.rules && message.rules.length) { - object.rules = []; - for (var j = 0; j < message.rules.length; ++j) - object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; - return object; - }; - - /** - * Converts this Http to JSON. - * @function toJSON - * @memberof google.api.Http - * @instance - * @returns {Object.} JSON object - */ - Http.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Http - * @function getTypeUrl - * @memberof google.api.Http - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.Http"; - }; - - return Http; - })(); - - api.HttpRule = (function() { - - /** - * Properties of a HttpRule. - * @memberof google.api - * @interface IHttpRule - * @property {string|null} [selector] HttpRule selector - * @property {string|null} [get] HttpRule get - * @property {string|null} [put] HttpRule put - * @property {string|null} [post] HttpRule post - * @property {string|null} ["delete"] HttpRule delete - * @property {string|null} [patch] HttpRule patch - * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom - * @property {string|null} [body] HttpRule body - * @property {string|null} [responseBody] HttpRule responseBody - * @property {Array.|null} [additionalBindings] HttpRule additionalBindings - */ - - /** - * Constructs a new HttpRule. - * @memberof google.api - * @classdesc Represents a HttpRule. - * @implements IHttpRule - * @constructor - * @param {google.api.IHttpRule=} [properties] Properties to set - */ - function HttpRule(properties) { - this.additionalBindings = []; - 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]]; - } - - /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; - - /** - * HttpRule get. - * @member {string|null|undefined} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = null; - - /** - * HttpRule put. - * @member {string|null|undefined} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = null; - - /** - * HttpRule post. - * @member {string|null|undefined} post - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.post = null; - - /** - * HttpRule delete. - * @member {string|null|undefined} delete - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype["delete"] = null; - - /** - * HttpRule patch. - * @member {string|null|undefined} patch - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.patch = null; - - /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.custom = null; - - /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.body = ""; - - /** - * HttpRule responseBody. - * @member {string} responseBody - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.responseBody = ""; - - /** - * HttpRule additionalBindings. - * @member {Array.} additionalBindings - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.additionalBindings = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * HttpRule pattern. - * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern - * @memberof google.api.HttpRule - * @instance - */ - Object.defineProperty(HttpRule.prototype, "pattern", { - get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new HttpRule instance using the specified properties. - * @function create - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule=} [properties] Properties to set - * @returns {google.api.HttpRule} HttpRule instance - */ - HttpRule.create = function create(properties) { - return new HttpRule(properties); - }; - - /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @function encode - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpRule.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && Object.hasOwnProperty.call(message, "get")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && Object.hasOwnProperty.call(message, "put")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && Object.hasOwnProperty.call(message, "post")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) - $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.additionalBindings != null && message.additionalBindings.length) - for (var i = 0; i < message.additionalBindings.length; ++i) - $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); - return writer; - }; - - /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a HttpRule message from the specified reader or buffer. - * @function decode - * @memberof google.api.HttpRule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.HttpRule} HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpRule.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.selector = reader.string(); - break; - } - case 2: { - message.get = reader.string(); - break; - } - case 3: { - message.put = reader.string(); - break; - } - case 4: { - message.post = reader.string(); - break; - } - case 5: { - message["delete"] = reader.string(); - break; - } - case 6: { - message.patch = reader.string(); - break; - } - case 8: { - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - } - case 7: { - message.body = reader.string(); - break; - } - case 12: { - message.responseBody = reader.string(); - break; - } - case 11: { - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.HttpRule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpRule.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HttpRule message. - * @function verify - * @memberof google.api.HttpRule - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HttpRule.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.get != null && message.hasOwnProperty("get")) { - properties.pattern = 1; - if (!$util.isString(message.get)) - return "get: string expected"; - } - if (message.put != null && message.hasOwnProperty("put")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.put)) - return "put: string expected"; - } - if (message.post != null && message.hasOwnProperty("post")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.post)) - return "post: string expected"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message["delete"])) - return "delete: string expected"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.patch)) - return "patch: string expected"; - } - if (message.custom != null && message.hasOwnProperty("custom")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - { - var error = $root.google.api.CustomHttpPattern.verify(message.custom); - if (error) - return "custom." + error; - } - } - if (message.body != null && message.hasOwnProperty("body")) - if (!$util.isString(message.body)) - return "body: string expected"; - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - if (!$util.isString(message.responseBody)) - return "responseBody: string expected"; - if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { - if (!Array.isArray(message.additionalBindings)) - return "additionalBindings: array expected"; - for (var i = 0; i < message.additionalBindings.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); - if (error) - return "additionalBindings." + error; - } - } - return null; - }; - - /** - * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.HttpRule - * @static - * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule - */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) - return object; - var message = new $root.google.api.HttpRule(); - if (object.selector != null) - message.selector = String(object.selector); - if (object.get != null) - message.get = String(object.get); - if (object.put != null) - message.put = String(object.put); - if (object.post != null) - message.post = String(object.post); - if (object["delete"] != null) - message["delete"] = String(object["delete"]); - if (object.patch != null) - message.patch = String(object.patch); - if (object.custom != null) { - if (typeof object.custom !== "object") - throw TypeError(".google.api.HttpRule.custom: object expected"); - message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); - } - if (object.body != null) - message.body = String(object.body); - if (object.responseBody != null) - message.responseBody = String(object.responseBody); - if (object.additionalBindings) { - if (!Array.isArray(object.additionalBindings)) - throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); - message.additionalBindings = []; - for (var i = 0; i < object.additionalBindings.length; ++i) { - if (typeof object.additionalBindings[i] !== "object") - throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); - message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.HttpRule - * @static - * @param {google.api.HttpRule} message HttpRule - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HttpRule.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.additionalBindings = []; - if (options.defaults) { - object.selector = ""; - object.body = ""; - object.responseBody = ""; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.get != null && message.hasOwnProperty("get")) { - object.get = message.get; - if (options.oneofs) - object.pattern = "get"; - } - if (message.put != null && message.hasOwnProperty("put")) { - object.put = message.put; - if (options.oneofs) - object.pattern = "put"; - } - if (message.post != null && message.hasOwnProperty("post")) { - object.post = message.post; - if (options.oneofs) - object.pattern = "post"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - object["delete"] = message["delete"]; - if (options.oneofs) - object.pattern = "delete"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - object.patch = message.patch; - if (options.oneofs) - object.pattern = "patch"; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = message.body; - if (message.custom != null && message.hasOwnProperty("custom")) { - object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); - if (options.oneofs) - object.pattern = "custom"; - } - if (message.additionalBindings && message.additionalBindings.length) { - object.additionalBindings = []; - for (var j = 0; j < message.additionalBindings.length; ++j) - object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); - } - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - object.responseBody = message.responseBody; - return object; - }; - - /** - * Converts this HttpRule to JSON. - * @function toJSON - * @memberof google.api.HttpRule - * @instance - * @returns {Object.} JSON object - */ - HttpRule.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for HttpRule - * @function getTypeUrl - * @memberof google.api.HttpRule - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.HttpRule"; - }; - - return HttpRule; - })(); - - api.CustomHttpPattern = (function() { - - /** - * Properties of a CustomHttpPattern. - * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path - */ - - /** - * Constructs a new CustomHttpPattern. - * @memberof google.api - * @classdesc Represents a CustomHttpPattern. - * @implements ICustomHttpPattern - * @constructor - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - */ - function CustomHttpPattern(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]]; - } - - /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.kind = ""; - - /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.path = ""; - - /** - * Creates a new CustomHttpPattern instance using the specified properties. - * @function create - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance - */ - CustomHttpPattern.create = function create(properties) { - return new CustomHttpPattern(properties); - }; - - /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @function encode - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomHttpPattern.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); - return writer; - }; - - /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. - * @function decode - * @memberof google.api.CustomHttpPattern - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomHttpPattern.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.path = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.CustomHttpPattern - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CustomHttpPattern message. - * @function verify - * @memberof google.api.CustomHttpPattern - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CustomHttpPattern.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; - return null; - }; - - /** - * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.CustomHttpPattern - * @static - * @param {Object.} object Plain object - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - */ - CustomHttpPattern.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CustomHttpPattern) - return object; - var message = new $root.google.api.CustomHttpPattern(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.path != null) - message.path = String(object.path); - return message; - }; - - /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.CustomHttpPattern} message CustomHttpPattern - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CustomHttpPattern.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.path = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; - return object; - }; - - /** - * Converts this CustomHttpPattern to JSON. - * @function toJSON - * @memberof google.api.CustomHttpPattern - * @instance - * @returns {Object.} JSON object - */ - CustomHttpPattern.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CustomHttpPattern - * @function getTypeUrl - * @memberof google.api.CustomHttpPattern - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.CustomHttpPattern"; - }; - - return CustomHttpPattern; - })(); - - /** - * FieldBehavior enum. - * @name google.api.FieldBehavior - * @enum {number} - * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value - * @property {number} OPTIONAL=1 OPTIONAL value - * @property {number} REQUIRED=2 REQUIRED value - * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value - * @property {number} INPUT_ONLY=4 INPUT_ONLY value - * @property {number} IMMUTABLE=5 IMMUTABLE value - * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value - * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value - */ - api.FieldBehavior = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; - values[valuesById[1] = "OPTIONAL"] = 1; - values[valuesById[2] = "REQUIRED"] = 2; - values[valuesById[3] = "OUTPUT_ONLY"] = 3; - values[valuesById[4] = "INPUT_ONLY"] = 4; - values[valuesById[5] = "IMMUTABLE"] = 5; - values[valuesById[6] = "UNORDERED_LIST"] = 6; - values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; - return values; - })(); - - api.ResourceDescriptor = (function() { - - /** - * Properties of a ResourceDescriptor. - * @memberof google.api - * @interface IResourceDescriptor - * @property {string|null} [type] ResourceDescriptor type - * @property {Array.|null} [pattern] ResourceDescriptor pattern - * @property {string|null} [nameField] ResourceDescriptor nameField - * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history - * @property {string|null} [plural] ResourceDescriptor plural - * @property {string|null} [singular] ResourceDescriptor singular - * @property {Array.|null} [style] ResourceDescriptor style - */ - - /** - * Constructs a new ResourceDescriptor. - * @memberof google.api - * @classdesc Represents a ResourceDescriptor. - * @implements IResourceDescriptor - * @constructor - * @param {google.api.IResourceDescriptor=} [properties] Properties to set - */ - function ResourceDescriptor(properties) { - this.pattern = []; - this.style = []; - 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]]; - } - - /** - * ResourceDescriptor type. - * @member {string} type - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.type = ""; - - /** - * ResourceDescriptor pattern. - * @member {Array.} pattern - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.pattern = $util.emptyArray; - - /** - * ResourceDescriptor nameField. - * @member {string} nameField - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.nameField = ""; - - /** - * ResourceDescriptor history. - * @member {google.api.ResourceDescriptor.History} history - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.history = 0; - - /** - * ResourceDescriptor plural. - * @member {string} plural - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.plural = ""; - - /** - * ResourceDescriptor singular. - * @member {string} singular - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.singular = ""; - - /** - * ResourceDescriptor style. - * @member {Array.} style - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.style = $util.emptyArray; - - /** - * Creates a new ResourceDescriptor instance using the specified properties. - * @function create - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.IResourceDescriptor=} [properties] Properties to set - * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance - */ - ResourceDescriptor.create = function create(properties) { - return new ResourceDescriptor(properties); - }; - - /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @function encode - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceDescriptor.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.pattern != null && message.pattern.length) - for (var i = 0; i < message.pattern.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); - if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); - if (message.history != null && Object.hasOwnProperty.call(message, "history")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); - if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); - if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); - if (message.style != null && message.style.length) { - writer.uint32(/* id 10, wireType 2 =*/82).fork(); - for (var i = 0; i < message.style.length; ++i) - writer.int32(message.style[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. - * @function decode - * @memberof google.api.ResourceDescriptor - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceDescriptor} ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceDescriptor.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type = reader.string(); - break; - } - case 2: { - if (!(message.pattern && message.pattern.length)) - message.pattern = []; - message.pattern.push(reader.string()); - break; - } - case 3: { - message.nameField = reader.string(); - break; - } - case 4: { - message.history = reader.int32(); - break; - } - case 5: { - message.plural = reader.string(); - break; - } - case 6: { - message.singular = reader.string(); - break; - } - case 10: { - if (!(message.style && message.style.length)) - message.style = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.style.push(reader.int32()); - } else - message.style.push(reader.int32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.ResourceDescriptor - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceDescriptor} ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResourceDescriptor message. - * @function verify - * @memberof google.api.ResourceDescriptor - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResourceDescriptor.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.pattern != null && message.hasOwnProperty("pattern")) { - if (!Array.isArray(message.pattern)) - return "pattern: array expected"; - for (var i = 0; i < message.pattern.length; ++i) - if (!$util.isString(message.pattern[i])) - return "pattern: string[] expected"; - } - if (message.nameField != null && message.hasOwnProperty("nameField")) - if (!$util.isString(message.nameField)) - return "nameField: string expected"; - if (message.history != null && message.hasOwnProperty("history")) - switch (message.history) { - default: - return "history: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.plural != null && message.hasOwnProperty("plural")) - if (!$util.isString(message.plural)) - return "plural: string expected"; - if (message.singular != null && message.hasOwnProperty("singular")) - if (!$util.isString(message.singular)) - return "singular: string expected"; - if (message.style != null && message.hasOwnProperty("style")) { - if (!Array.isArray(message.style)) - return "style: array expected"; - for (var i = 0; i < message.style.length; ++i) - switch (message.style[i]) { - default: - return "style: enum value[] expected"; - case 0: - case 1: - break; - } - } - return null; - }; - - /** - * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.ResourceDescriptor - * @static - * @param {Object.} object Plain object - * @returns {google.api.ResourceDescriptor} ResourceDescriptor - */ - ResourceDescriptor.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceDescriptor) - return object; - var message = new $root.google.api.ResourceDescriptor(); - if (object.type != null) - message.type = String(object.type); - if (object.pattern) { - if (!Array.isArray(object.pattern)) - throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); - message.pattern = []; - for (var i = 0; i < object.pattern.length; ++i) - message.pattern[i] = String(object.pattern[i]); - } - if (object.nameField != null) - message.nameField = String(object.nameField); - switch (object.history) { - default: - if (typeof object.history === "number") { - message.history = object.history; - break; - } - break; - case "HISTORY_UNSPECIFIED": - case 0: - message.history = 0; - break; - case "ORIGINALLY_SINGLE_PATTERN": - case 1: - message.history = 1; - break; - case "FUTURE_MULTI_PATTERN": - case 2: - message.history = 2; - break; - } - if (object.plural != null) - message.plural = String(object.plural); - if (object.singular != null) - message.singular = String(object.singular); - if (object.style) { - if (!Array.isArray(object.style)) - throw TypeError(".google.api.ResourceDescriptor.style: array expected"); - message.style = []; - for (var i = 0; i < object.style.length; ++i) - switch (object.style[i]) { - default: - if (typeof object.style[i] === "number") { - message.style[i] = object.style[i]; - break; - } - case "STYLE_UNSPECIFIED": - case 0: - message.style[i] = 0; - break; - case "DECLARATIVE_FRIENDLY": - case 1: - message.style[i] = 1; - break; - } - } - return message; - }; - - /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.ResourceDescriptor} message ResourceDescriptor - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResourceDescriptor.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.pattern = []; - object.style = []; - } - if (options.defaults) { - object.type = ""; - object.nameField = ""; - object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; - object.plural = ""; - object.singular = ""; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.pattern && message.pattern.length) { - object.pattern = []; - for (var j = 0; j < message.pattern.length; ++j) - object.pattern[j] = message.pattern[j]; - } - if (message.nameField != null && message.hasOwnProperty("nameField")) - object.nameField = message.nameField; - if (message.history != null && message.hasOwnProperty("history")) - object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; - if (message.plural != null && message.hasOwnProperty("plural")) - object.plural = message.plural; - if (message.singular != null && message.hasOwnProperty("singular")) - object.singular = message.singular; - if (message.style && message.style.length) { - object.style = []; - for (var j = 0; j < message.style.length; ++j) - object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; - } - return object; - }; - - /** - * Converts this ResourceDescriptor to JSON. - * @function toJSON - * @memberof google.api.ResourceDescriptor - * @instance - * @returns {Object.} JSON object - */ - ResourceDescriptor.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResourceDescriptor - * @function getTypeUrl - * @memberof google.api.ResourceDescriptor - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.ResourceDescriptor"; - }; - - /** - * History enum. - * @name google.api.ResourceDescriptor.History - * @enum {number} - * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value - * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value - * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value - */ - ResourceDescriptor.History = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; - values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; - values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; - return values; - })(); - - /** - * Style enum. - * @name google.api.ResourceDescriptor.Style - * @enum {number} - * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value - * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value - */ - ResourceDescriptor.Style = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; - return values; - })(); - - return ResourceDescriptor; - })(); - - api.ResourceReference = (function() { - - /** - * Properties of a ResourceReference. - * @memberof google.api - * @interface IResourceReference - * @property {string|null} [type] ResourceReference type - * @property {string|null} [childType] ResourceReference childType - */ - - /** - * Constructs a new ResourceReference. - * @memberof google.api - * @classdesc Represents a ResourceReference. - * @implements IResourceReference - * @constructor - * @param {google.api.IResourceReference=} [properties] Properties to set - */ - function ResourceReference(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]]; - } - - /** - * ResourceReference type. - * @member {string} type - * @memberof google.api.ResourceReference - * @instance - */ - ResourceReference.prototype.type = ""; - - /** - * ResourceReference childType. - * @member {string} childType - * @memberof google.api.ResourceReference - * @instance - */ - ResourceReference.prototype.childType = ""; - - /** - * Creates a new ResourceReference instance using the specified properties. - * @function create - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference=} [properties] Properties to set - * @returns {google.api.ResourceReference} ResourceReference instance - */ - ResourceReference.create = function create(properties) { - return new ResourceReference(properties); - }; - - /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @function encode - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceReference.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); - return writer; - }; - - /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResourceReference message from the specified reader or buffer. - * @function decode - * @memberof google.api.ResourceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceReference} ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceReference.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type = reader.string(); - break; - } - case 2: { - message.childType = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.ResourceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceReference} ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceReference.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResourceReference message. - * @function verify - * @memberof google.api.ResourceReference - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResourceReference.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.childType != null && message.hasOwnProperty("childType")) - if (!$util.isString(message.childType)) - return "childType: string expected"; - return null; - }; - - /** - * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.ResourceReference - * @static - * @param {Object.} object Plain object - * @returns {google.api.ResourceReference} ResourceReference - */ - ResourceReference.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceReference) - return object; - var message = new $root.google.api.ResourceReference(); - if (object.type != null) - message.type = String(object.type); - if (object.childType != null) - message.childType = String(object.childType); - return message; - }; - - /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.ResourceReference - * @static - * @param {google.api.ResourceReference} message ResourceReference - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResourceReference.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = ""; - object.childType = ""; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.childType != null && message.hasOwnProperty("childType")) - object.childType = message.childType; - return object; - }; - - /** - * Converts this ResourceReference to JSON. - * @function toJSON - * @memberof google.api.ResourceReference - * @instance - * @returns {Object.} JSON object - */ - ResourceReference.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResourceReference - * @function getTypeUrl - * @memberof google.api.ResourceReference - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.ResourceReference"; - }; - - return ResourceReference; - })(); - - return api; - })(); - - google.protobuf = (function() { - - /** - * Namespace protobuf. - * @memberof google - * @namespace - */ - var protobuf = {}; - - protobuf.FileDescriptorSet = (function() { - - /** - * Properties of a FileDescriptorSet. - * @memberof google.protobuf - * @interface IFileDescriptorSet - * @property {Array.|null} [file] FileDescriptorSet file - */ - - /** - * Constructs a new FileDescriptorSet. - * @memberof google.protobuf - * @classdesc Represents a FileDescriptorSet. - * @implements IFileDescriptorSet - * @constructor - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set - */ - function FileDescriptorSet(properties) { - this.file = []; - 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]]; - } - - /** - * FileDescriptorSet file. - * @member {Array.} file - * @memberof google.protobuf.FileDescriptorSet - * @instance - */ - FileDescriptorSet.prototype.file = $util.emptyArray; - - /** - * Creates a new FileDescriptorSet instance using the specified properties. - * @function create - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance - */ - FileDescriptorSet.create = function create(properties) { - return new FileDescriptorSet(properties); - }; - - /** - * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.file != null && message.file.length) - for (var i = 0; i < message.file.length; ++i) - $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorSet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.file && message.file.length)) - message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileDescriptorSet message. - * @function verify - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileDescriptorSet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.file != null && message.hasOwnProperty("file")) { - if (!Array.isArray(message.file)) - return "file: array expected"; - for (var i = 0; i < message.file.length; ++i) { - var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); - if (error) - return "file." + error; - } - } - return null; - }; - - /** - * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - */ - FileDescriptorSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorSet) - return object; - var message = new $root.google.protobuf.FileDescriptorSet(); - if (object.file) { - if (!Array.isArray(object.file)) - throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); - message.file = []; - for (var i = 0; i < object.file.length; ++i) { - if (typeof object.file[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); - message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileDescriptorSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.file = []; - if (message.file && message.file.length) { - object.file = []; - for (var j = 0; j < message.file.length; ++j) - object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); - } - return object; - }; - - /** - * Converts this FileDescriptorSet to JSON. - * @function toJSON - * @memberof google.protobuf.FileDescriptorSet - * @instance - * @returns {Object.} JSON object - */ - FileDescriptorSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FileDescriptorSet - * @function getTypeUrl - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; - }; - - return FileDescriptorSet; - })(); - - protobuf.FileDescriptorProto = (function() { - - /** - * Properties of a FileDescriptorProto. - * @memberof google.protobuf - * @interface IFileDescriptorProto - * @property {string|null} [name] FileDescriptorProto name - * @property {string|null} ["package"] FileDescriptorProto package - * @property {Array.|null} [dependency] FileDescriptorProto dependency - * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency - * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency - * @property {Array.|null} [messageType] FileDescriptorProto messageType - * @property {Array.|null} [enumType] FileDescriptorProto enumType - * @property {Array.|null} [service] FileDescriptorProto service - * @property {Array.|null} [extension] FileDescriptorProto extension - * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options - * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo - * @property {string|null} [syntax] FileDescriptorProto syntax - * @property {string|null} [edition] FileDescriptorProto edition - */ - - /** - * Constructs a new FileDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a FileDescriptorProto. - * @implements IFileDescriptorProto - * @constructor - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set - */ - function FileDescriptorProto(properties) { - this.dependency = []; - this.publicDependency = []; - this.weakDependency = []; - this.messageType = []; - this.enumType = []; - this.service = []; - this.extension = []; - 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]]; - } - - /** - * FileDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.name = ""; - - /** - * FileDescriptorProto package. - * @member {string} package - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype["package"] = ""; - - /** - * FileDescriptorProto dependency. - * @member {Array.} dependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.dependency = $util.emptyArray; - - /** - * FileDescriptorProto publicDependency. - * @member {Array.} publicDependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.publicDependency = $util.emptyArray; - - /** - * FileDescriptorProto weakDependency. - * @member {Array.} weakDependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.weakDependency = $util.emptyArray; - - /** - * FileDescriptorProto messageType. - * @member {Array.} messageType - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.messageType = $util.emptyArray; - - /** - * FileDescriptorProto enumType. - * @member {Array.} enumType - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.enumType = $util.emptyArray; - - /** - * FileDescriptorProto service. - * @member {Array.} service - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.service = $util.emptyArray; - - /** - * FileDescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.extension = $util.emptyArray; - - /** - * FileDescriptorProto options. - * @member {google.protobuf.IFileOptions|null|undefined} options - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.options = null; - - /** - * FileDescriptorProto sourceCodeInfo. - * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.sourceCodeInfo = null; - - /** - * FileDescriptorProto syntax. - * @member {string} syntax - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.syntax = ""; - - /** - * FileDescriptorProto edition. - * @member {string} edition - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.edition = ""; - - /** - * Creates a new FileDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance - */ - FileDescriptorProto.create = function create(properties) { - return new FileDescriptorProto(properties); - }; - - /** - * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); - if (message.dependency != null && message.dependency.length) - for (var i = 0; i < message.dependency.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); - if (message.messageType != null && message.messageType.length) - for (var i = 0; i < message.messageType.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.enumType != null && message.enumType.length) - for (var i = 0; i < message.enumType.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.service != null && message.service.length) - for (var i = 0; i < message.service.length; ++i) - $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.extension != null && message.extension.length) - for (var i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) - $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.publicDependency != null && message.publicDependency.length) - for (var i = 0; i < message.publicDependency.length; ++i) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); - if (message.weakDependency != null && message.weakDependency.length) - for (var i = 0; i < message.weakDependency.length; ++i) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); - if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); - return writer; - }; - - /** - * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message["package"] = reader.string(); - break; - } - case 3: { - if (!(message.dependency && message.dependency.length)) - message.dependency = []; - message.dependency.push(reader.string()); - break; - } - case 10: { - if (!(message.publicDependency && message.publicDependency.length)) - message.publicDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.publicDependency.push(reader.int32()); - } else - message.publicDependency.push(reader.int32()); - break; - } - case 11: { - if (!(message.weakDependency && message.weakDependency.length)) - message.weakDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.weakDependency.push(reader.int32()); - } else - message.weakDependency.push(reader.int32()); - break; - } - case 4: { - if (!(message.messageType && message.messageType.length)) - message.messageType = []; - message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.service && message.service.length)) - message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 7: { - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 8: { - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); - break; - } - case 9: { - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); - break; - } - case 12: { - message.syntax = reader.string(); - break; - } - case 13: { - message.edition = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileDescriptorProto message. - * @function verify - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileDescriptorProto.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["package"] != null && message.hasOwnProperty("package")) - if (!$util.isString(message["package"])) - return "package: string expected"; - if (message.dependency != null && message.hasOwnProperty("dependency")) { - if (!Array.isArray(message.dependency)) - return "dependency: array expected"; - for (var i = 0; i < message.dependency.length; ++i) - if (!$util.isString(message.dependency[i])) - return "dependency: string[] expected"; - } - if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { - if (!Array.isArray(message.publicDependency)) - return "publicDependency: array expected"; - for (var i = 0; i < message.publicDependency.length; ++i) - if (!$util.isInteger(message.publicDependency[i])) - return "publicDependency: integer[] expected"; - } - if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { - if (!Array.isArray(message.weakDependency)) - return "weakDependency: array expected"; - for (var i = 0; i < message.weakDependency.length; ++i) - if (!$util.isInteger(message.weakDependency[i])) - return "weakDependency: integer[] expected"; - } - if (message.messageType != null && message.hasOwnProperty("messageType")) { - if (!Array.isArray(message.messageType)) - return "messageType: array expected"; - for (var i = 0; i < message.messageType.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); - if (error) - return "messageType." + error; - } - } - if (message.enumType != null && message.hasOwnProperty("enumType")) { - if (!Array.isArray(message.enumType)) - return "enumType: array expected"; - for (var i = 0; i < message.enumType.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); - if (error) - return "enumType." + error; - } - } - if (message.service != null && message.hasOwnProperty("service")) { - if (!Array.isArray(message.service)) - return "service: array expected"; - for (var i = 0; i < message.service.length; ++i) { - var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); - if (error) - return "service." + error; - } - } - if (message.extension != null && message.hasOwnProperty("extension")) { - if (!Array.isArray(message.extension)) - return "extension: array expected"; - for (var i = 0; i < message.extension.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); - if (error) - return "extension." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.FileOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { - var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); - if (error) - return "sourceCodeInfo." + error; - } - if (message.syntax != null && message.hasOwnProperty("syntax")) - if (!$util.isString(message.syntax)) - return "syntax: string expected"; - if (message.edition != null && message.hasOwnProperty("edition")) - if (!$util.isString(message.edition)) - return "edition: string expected"; - return null; - }; - - /** - * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - */ - FileDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorProto) - return object; - var message = new $root.google.protobuf.FileDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object["package"] != null) - message["package"] = String(object["package"]); - if (object.dependency) { - if (!Array.isArray(object.dependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); - message.dependency = []; - for (var i = 0; i < object.dependency.length; ++i) - message.dependency[i] = String(object.dependency[i]); - } - if (object.publicDependency) { - if (!Array.isArray(object.publicDependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); - message.publicDependency = []; - for (var i = 0; i < object.publicDependency.length; ++i) - message.publicDependency[i] = object.publicDependency[i] | 0; - } - if (object.weakDependency) { - if (!Array.isArray(object.weakDependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); - message.weakDependency = []; - for (var i = 0; i < object.weakDependency.length; ++i) - message.weakDependency[i] = object.weakDependency[i] | 0; - } - if (object.messageType) { - if (!Array.isArray(object.messageType)) - throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); - message.messageType = []; - for (var i = 0; i < object.messageType.length; ++i) { - if (typeof object.messageType[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); - message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); - } - } - if (object.enumType) { - if (!Array.isArray(object.enumType)) - throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); - message.enumType = []; - for (var i = 0; i < object.enumType.length; ++i) { - if (typeof object.enumType[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); - message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); - } - } - if (object.service) { - if (!Array.isArray(object.service)) - throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); - message.service = []; - for (var i = 0; i < object.service.length; ++i) { - if (typeof object.service[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); - message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); - } - } - if (object.extension) { - if (!Array.isArray(object.extension)) - throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); - message.extension = []; - for (var i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FileOptions.fromObject(object.options); - } - if (object.sourceCodeInfo != null) { - if (typeof object.sourceCodeInfo !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); - } - if (object.syntax != null) - message.syntax = String(object.syntax); - if (object.edition != null) - message.edition = String(object.edition); - return message; - }; - - /** - * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.dependency = []; - object.messageType = []; - object.enumType = []; - object.service = []; - object.extension = []; - object.publicDependency = []; - object.weakDependency = []; - } - if (options.defaults) { - object.name = ""; - object["package"] = ""; - object.options = null; - object.sourceCodeInfo = null; - object.syntax = ""; - object.edition = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message["package"] != null && message.hasOwnProperty("package")) - object["package"] = message["package"]; - if (message.dependency && message.dependency.length) { - object.dependency = []; - for (var j = 0; j < message.dependency.length; ++j) - object.dependency[j] = message.dependency[j]; - } - if (message.messageType && message.messageType.length) { - object.messageType = []; - for (var j = 0; j < message.messageType.length; ++j) - object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); - } - if (message.enumType && message.enumType.length) { - object.enumType = []; - for (var j = 0; j < message.enumType.length; ++j) - object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); - } - if (message.service && message.service.length) { - object.service = []; - for (var j = 0; j < message.service.length; ++j) - object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); - } - if (message.extension && message.extension.length) { - object.extension = []; - for (var j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); - if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) - object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); - if (message.publicDependency && message.publicDependency.length) { - object.publicDependency = []; - for (var j = 0; j < message.publicDependency.length; ++j) - object.publicDependency[j] = message.publicDependency[j]; - } - if (message.weakDependency && message.weakDependency.length) { - object.weakDependency = []; - for (var j = 0; j < message.weakDependency.length; ++j) - object.weakDependency[j] = message.weakDependency[j]; - } - if (message.syntax != null && message.hasOwnProperty("syntax")) - object.syntax = message.syntax; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = message.edition; - return object; - }; - - /** - * Converts this FileDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.FileDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - FileDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FileDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; - }; - - return FileDescriptorProto; - })(); - - protobuf.DescriptorProto = (function() { - - /** - * Properties of a DescriptorProto. - * @memberof google.protobuf - * @interface IDescriptorProto - * @property {string|null} [name] DescriptorProto name - * @property {Array.|null} [field] DescriptorProto field - * @property {Array.|null} [extension] DescriptorProto extension - * @property {Array.|null} [nestedType] DescriptorProto nestedType - * @property {Array.|null} [enumType] DescriptorProto enumType - * @property {Array.|null} [extensionRange] DescriptorProto extensionRange - * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl - * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options - * @property {Array.|null} [reservedRange] DescriptorProto reservedRange - * @property {Array.|null} [reservedName] DescriptorProto reservedName - */ - - /** - * Constructs a new DescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a DescriptorProto. - * @implements IDescriptorProto - * @constructor - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set - */ - function DescriptorProto(properties) { - this.field = []; - this.extension = []; - this.nestedType = []; - this.enumType = []; - this.extensionRange = []; - this.oneofDecl = []; - this.reservedRange = []; - this.reservedName = []; - 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]]; - } - - /** - * DescriptorProto name. - * @member {string} name - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.name = ""; - - /** - * DescriptorProto field. - * @member {Array.} field - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.field = $util.emptyArray; - - /** - * DescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.extension = $util.emptyArray; - - /** - * DescriptorProto nestedType. - * @member {Array.} nestedType - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.nestedType = $util.emptyArray; - - /** - * DescriptorProto enumType. - * @member {Array.} enumType - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.enumType = $util.emptyArray; - - /** - * DescriptorProto extensionRange. - * @member {Array.} extensionRange - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.extensionRange = $util.emptyArray; - - /** - * DescriptorProto oneofDecl. - * @member {Array.} oneofDecl - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.oneofDecl = $util.emptyArray; - - /** - * DescriptorProto options. - * @member {google.protobuf.IMessageOptions|null|undefined} options - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.options = null; - - /** - * DescriptorProto reservedRange. - * @member {Array.} reservedRange - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.reservedRange = $util.emptyArray; - - /** - * DescriptorProto reservedName. - * @member {Array.} reservedName - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.reservedName = $util.emptyArray; - - /** - * Creates a new DescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto} DescriptorProto instance - */ - DescriptorProto.create = function create(properties) { - return new DescriptorProto(properties); - }; - - /** - * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.field != null && message.field.length) - for (var i = 0; i < message.field.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nestedType != null && message.nestedType.length) - for (var i = 0; i < message.nestedType.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.enumType != null && message.enumType.length) - for (var i = 0; i < message.enumType.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.extensionRange != null && message.extensionRange.length) - for (var i = 0; i < message.extensionRange.length; ++i) - $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.extension != null && message.extension.length) - for (var i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.oneofDecl != null && message.oneofDecl.length) - for (var i = 0; i < message.oneofDecl.length; ++i) - $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.reservedRange != null && message.reservedRange.length) - for (var i = 0; i < message.reservedRange.length; ++i) - $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.reservedName != null && message.reservedName.length) - for (var i = 0; i < message.reservedName.length; ++i) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); - return writer; - }; - - /** - * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto} DescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.field && message.field.length)) - message.field = []; - message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.nestedType && message.nestedType.length)) - message.nestedType = []; - message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - } - case 4: { - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.extensionRange && message.extensionRange.length)) - message.extensionRange = []; - message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); - break; - } - case 8: { - if (!(message.oneofDecl && message.oneofDecl.length)) - message.oneofDecl = []; - message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 7: { - message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); - break; - } - case 9: { - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); - break; - } - case 10: { - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto} DescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DescriptorProto message. - * @function verify - * @memberof google.protobuf.DescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DescriptorProto.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.field != null && message.hasOwnProperty("field")) { - if (!Array.isArray(message.field)) - return "field: array expected"; - for (var i = 0; i < message.field.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); - if (error) - return "field." + error; - } - } - if (message.extension != null && message.hasOwnProperty("extension")) { - if (!Array.isArray(message.extension)) - return "extension: array expected"; - for (var i = 0; i < message.extension.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); - if (error) - return "extension." + error; - } - } - if (message.nestedType != null && message.hasOwnProperty("nestedType")) { - if (!Array.isArray(message.nestedType)) - return "nestedType: array expected"; - for (var i = 0; i < message.nestedType.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); - if (error) - return "nestedType." + error; - } - } - if (message.enumType != null && message.hasOwnProperty("enumType")) { - if (!Array.isArray(message.enumType)) - return "enumType: array expected"; - for (var i = 0; i < message.enumType.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); - if (error) - return "enumType." + error; - } - } - if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { - if (!Array.isArray(message.extensionRange)) - return "extensionRange: array expected"; - for (var i = 0; i < message.extensionRange.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); - if (error) - return "extensionRange." + error; - } - } - if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { - if (!Array.isArray(message.oneofDecl)) - return "oneofDecl: array expected"; - for (var i = 0; i < message.oneofDecl.length; ++i) { - var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); - if (error) - return "oneofDecl." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.MessageOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { - if (!Array.isArray(message.reservedRange)) - return "reservedRange: array expected"; - for (var i = 0; i < message.reservedRange.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); - if (error) - return "reservedRange." + error; - } - } - if (message.reservedName != null && message.hasOwnProperty("reservedName")) { - if (!Array.isArray(message.reservedName)) - return "reservedName: array expected"; - for (var i = 0; i < message.reservedName.length; ++i) - if (!$util.isString(message.reservedName[i])) - return "reservedName: string[] expected"; - } - return null; - }; - - /** - * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto} DescriptorProto - */ - DescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto) - return object; - var message = new $root.google.protobuf.DescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.field) { - if (!Array.isArray(object.field)) - throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); - message.field = []; - for (var i = 0; i < object.field.length; ++i) { - if (typeof object.field[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); - message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); - } - } - if (object.extension) { - if (!Array.isArray(object.extension)) - throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); - message.extension = []; - for (var i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); - } - } - if (object.nestedType) { - if (!Array.isArray(object.nestedType)) - throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); - message.nestedType = []; - for (var i = 0; i < object.nestedType.length; ++i) { - if (typeof object.nestedType[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); - message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); - } - } - if (object.enumType) { - if (!Array.isArray(object.enumType)) - throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); - message.enumType = []; - for (var i = 0; i < object.enumType.length; ++i) { - if (typeof object.enumType[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); - message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); - } - } - if (object.extensionRange) { - if (!Array.isArray(object.extensionRange)) - throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); - message.extensionRange = []; - for (var i = 0; i < object.extensionRange.length; ++i) { - if (typeof object.extensionRange[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); - message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); - } - } - if (object.oneofDecl) { - if (!Array.isArray(object.oneofDecl)) - throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); - message.oneofDecl = []; - for (var i = 0; i < object.oneofDecl.length; ++i) { - if (typeof object.oneofDecl[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); - message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); - } - if (object.reservedRange) { - if (!Array.isArray(object.reservedRange)) - throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); - message.reservedRange = []; - for (var i = 0; i < object.reservedRange.length; ++i) { - if (typeof object.reservedRange[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); - message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); - } - } - if (object.reservedName) { - if (!Array.isArray(object.reservedName)) - throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); - message.reservedName = []; - for (var i = 0; i < object.reservedName.length; ++i) - message.reservedName[i] = String(object.reservedName[i]); - } - return message; - }; - - /** - * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.DescriptorProto} message DescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.field = []; - object.nestedType = []; - object.enumType = []; - object.extensionRange = []; - object.extension = []; - object.oneofDecl = []; - object.reservedRange = []; - object.reservedName = []; - } - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.field && message.field.length) { - object.field = []; - for (var j = 0; j < message.field.length; ++j) - object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); - } - if (message.nestedType && message.nestedType.length) { - object.nestedType = []; - for (var j = 0; j < message.nestedType.length; ++j) - object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); - } - if (message.enumType && message.enumType.length) { - object.enumType = []; - for (var j = 0; j < message.enumType.length; ++j) - object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); - } - if (message.extensionRange && message.extensionRange.length) { - object.extensionRange = []; - for (var j = 0; j < message.extensionRange.length; ++j) - object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); - } - if (message.extension && message.extension.length) { - object.extension = []; - for (var j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); - if (message.oneofDecl && message.oneofDecl.length) { - object.oneofDecl = []; - for (var j = 0; j < message.oneofDecl.length; ++j) - object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); - } - if (message.reservedRange && message.reservedRange.length) { - object.reservedRange = []; - for (var j = 0; j < message.reservedRange.length; ++j) - object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); - } - if (message.reservedName && message.reservedName.length) { - object.reservedName = []; - for (var j = 0; j < message.reservedName.length; ++j) - object.reservedName[j] = message.reservedName[j]; - } - return object; - }; - - /** - * Converts this DescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto - * @instance - * @returns {Object.} JSON object - */ - DescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DescriptorProto"; - }; - - DescriptorProto.ExtensionRange = (function() { - - /** - * Properties of an ExtensionRange. - * @memberof google.protobuf.DescriptorProto - * @interface IExtensionRange - * @property {number|null} [start] ExtensionRange start - * @property {number|null} [end] ExtensionRange end - * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options - */ - - /** - * Constructs a new ExtensionRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents an ExtensionRange. - * @implements IExtensionRange - * @constructor - * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set - */ - function ExtensionRange(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]]; - } - - /** - * ExtensionRange start. - * @member {number} start - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.start = 0; - - /** - * ExtensionRange end. - * @member {number} end - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.end = 0; - - /** - * ExtensionRange options. - * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.options = null; - - /** - * Creates a new ExtensionRange instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance - */ - ExtensionRange.create = function create(properties) { - return new ExtensionRange(properties); - }; - - /** - * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.start = reader.int32(); - break; - } - case 2: { - message.end = reader.int32(); - break; - } - case 3: { - message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExtensionRange message. - * @function verify - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExtensionRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - */ - ExtensionRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) - return object; - var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); - message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExtensionRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - object.options = null; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this ExtensionRange to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - * @returns {Object.} JSON object - */ - ExtensionRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExtensionRange - * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; - }; - - return ExtensionRange; - })(); - - DescriptorProto.ReservedRange = (function() { - - /** - * Properties of a ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @interface IReservedRange - * @property {number|null} [start] ReservedRange start - * @property {number|null} [end] ReservedRange end - */ - - /** - * Constructs a new ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents a ReservedRange. - * @implements IReservedRange - * @constructor - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set - */ - function ReservedRange(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]]; - } - - /** - * ReservedRange start. - * @member {number} start - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - */ - ReservedRange.prototype.start = 0; - - /** - * ReservedRange end. - * @member {number} end - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - */ - ReservedRange.prototype.end = 0; - - /** - * Creates a new ReservedRange instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance - */ - ReservedRange.create = function create(properties) { - return new ReservedRange(properties); - }; - - /** - * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReservedRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - return writer; - }; - - /** - * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReservedRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReservedRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.start = reader.int32(); - break; - } - case 2: { - message.end = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReservedRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReservedRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReservedRange message. - * @function verify - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReservedRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - return null; - }; - - /** - * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - */ - ReservedRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) - return object; - var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - return message; - }; - - /** - * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReservedRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - return object; - }; - - /** - * Converts this ReservedRange to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - * @returns {Object.} JSON object - */ - ReservedRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReservedRange - * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; - }; - - return ReservedRange; - })(); - - return DescriptorProto; - })(); - - protobuf.ExtensionRangeOptions = (function() { - - /** - * Properties of an ExtensionRangeOptions. - * @memberof google.protobuf - * @interface IExtensionRangeOptions - * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption - */ - - /** - * Constructs a new ExtensionRangeOptions. - * @memberof google.protobuf - * @classdesc Represents an ExtensionRangeOptions. - * @implements IExtensionRangeOptions - * @constructor - * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set - */ - function ExtensionRangeOptions(properties) { - this.uninterpretedOption = []; - 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]]; - } - - /** - * ExtensionRangeOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * Creates a new ExtensionRangeOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance - */ - ExtensionRangeOptions.create = function create(properties) { - return new ExtensionRangeOptions(properties); - }; - - /** - * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRangeOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRangeOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExtensionRangeOptions message. - * @function verify - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExtensionRangeOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - return null; - }; - - /** - * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions - */ - ExtensionRangeOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ExtensionRangeOptions) - return object; - var message = new $root.google.protobuf.ExtensionRangeOptions(); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExtensionRangeOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; - - /** - * Converts this ExtensionRangeOptions to JSON. - * @function toJSON - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - * @returns {Object.} JSON object - */ - ExtensionRangeOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExtensionRangeOptions - * @function getTypeUrl - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; - }; - - return ExtensionRangeOptions; - })(); - - protobuf.FieldDescriptorProto = (function() { - - /** - * Properties of a FieldDescriptorProto. - * @memberof google.protobuf - * @interface IFieldDescriptorProto - * @property {string|null} [name] FieldDescriptorProto name - * @property {number|null} [number] FieldDescriptorProto number - * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label - * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type - * @property {string|null} [typeName] FieldDescriptorProto typeName - * @property {string|null} [extendee] FieldDescriptorProto extendee - * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue - * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex - * @property {string|null} [jsonName] FieldDescriptorProto jsonName - * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options - * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional - */ - - /** - * Constructs a new FieldDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a FieldDescriptorProto. - * @implements IFieldDescriptorProto - * @constructor - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set - */ - function FieldDescriptorProto(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]]; - } - - /** - * FieldDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.name = ""; - - /** - * FieldDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.number = 0; - - /** - * FieldDescriptorProto label. - * @member {google.protobuf.FieldDescriptorProto.Label} label - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.label = 1; - - /** - * FieldDescriptorProto type. - * @member {google.protobuf.FieldDescriptorProto.Type} type - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.type = 1; - - /** - * FieldDescriptorProto typeName. - * @member {string} typeName - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.typeName = ""; - - /** - * FieldDescriptorProto extendee. - * @member {string} extendee - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.extendee = ""; - - /** - * FieldDescriptorProto defaultValue. - * @member {string} defaultValue - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.defaultValue = ""; - - /** - * FieldDescriptorProto oneofIndex. - * @member {number} oneofIndex - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.oneofIndex = 0; - - /** - * FieldDescriptorProto jsonName. - * @member {string} jsonName - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.jsonName = ""; - - /** - * FieldDescriptorProto options. - * @member {google.protobuf.IFieldOptions|null|undefined} options - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.options = null; - - /** - * FieldDescriptorProto proto3Optional. - * @member {boolean} proto3Optional - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.proto3Optional = false; - - /** - * Creates a new FieldDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance - */ - FieldDescriptorProto.create = function create(properties) { - return new FieldDescriptorProto(properties); - }; - - /** - * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); - if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); - if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); - if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); - if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) - writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); - return writer; - }; - - /** - * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 3: { - message.number = reader.int32(); - break; - } - case 4: { - message.label = reader.int32(); - break; - } - case 5: { - message.type = reader.int32(); - break; - } - case 6: { - message.typeName = reader.string(); - break; - } - case 2: { - message.extendee = reader.string(); - break; - } - case 7: { - message.defaultValue = reader.string(); - break; - } - case 9: { - message.oneofIndex = reader.int32(); - break; - } - case 10: { - message.jsonName = reader.string(); - break; - } - case 8: { - message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); - break; - } - case 17: { - message.proto3Optional = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldDescriptorProto message. - * @function verify - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldDescriptorProto.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.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.label != null && message.hasOwnProperty("label")) - switch (message.label) { - default: - return "label: enum value expected"; - case 1: - case 2: - case 3: - break; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - 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: - break; - } - if (message.typeName != null && message.hasOwnProperty("typeName")) - if (!$util.isString(message.typeName)) - return "typeName: string expected"; - if (message.extendee != null && message.hasOwnProperty("extendee")) - if (!$util.isString(message.extendee)) - return "extendee: string expected"; - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) - if (!$util.isString(message.defaultValue)) - return "defaultValue: string expected"; - if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) - if (!$util.isInteger(message.oneofIndex)) - return "oneofIndex: integer expected"; - if (message.jsonName != null && message.hasOwnProperty("jsonName")) - if (!$util.isString(message.jsonName)) - return "jsonName: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.FieldOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) - if (typeof message.proto3Optional !== "boolean") - return "proto3Optional: boolean expected"; - return null; - }; - - /** - * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - */ - FieldDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldDescriptorProto) - return object; - var message = new $root.google.protobuf.FieldDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.number != null) - message.number = object.number | 0; - switch (object.label) { - default: - if (typeof object.label === "number") { - message.label = object.label; - break; - } - break; - case "LABEL_OPTIONAL": - case 1: - message.label = 1; - break; - case "LABEL_REQUIRED": - case 2: - message.label = 2; - break; - case "LABEL_REPEATED": - case 3: - message.label = 3; - break; - } - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "TYPE_DOUBLE": - case 1: - message.type = 1; - break; - case "TYPE_FLOAT": - case 2: - message.type = 2; - break; - case "TYPE_INT64": - case 3: - message.type = 3; - break; - case "TYPE_UINT64": - case 4: - message.type = 4; - break; - case "TYPE_INT32": - case 5: - message.type = 5; - break; - case "TYPE_FIXED64": - case 6: - message.type = 6; - break; - case "TYPE_FIXED32": - case 7: - message.type = 7; - break; - case "TYPE_BOOL": - case 8: - message.type = 8; - break; - case "TYPE_STRING": - case 9: - message.type = 9; - break; - case "TYPE_GROUP": - case 10: - message.type = 10; - break; - case "TYPE_MESSAGE": - case 11: - message.type = 11; - break; - case "TYPE_BYTES": - case 12: - message.type = 12; - break; - case "TYPE_UINT32": - case 13: - message.type = 13; - break; - case "TYPE_ENUM": - case 14: - message.type = 14; - break; - case "TYPE_SFIXED32": - case 15: - message.type = 15; - break; - case "TYPE_SFIXED64": - case 16: - message.type = 16; - break; - case "TYPE_SINT32": - case 17: - message.type = 17; - break; - case "TYPE_SINT64": - case 18: - message.type = 18; - break; - } - if (object.typeName != null) - message.typeName = String(object.typeName); - if (object.extendee != null) - message.extendee = String(object.extendee); - if (object.defaultValue != null) - message.defaultValue = String(object.defaultValue); - if (object.oneofIndex != null) - message.oneofIndex = object.oneofIndex | 0; - if (object.jsonName != null) - message.jsonName = String(object.jsonName); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); - } - if (object.proto3Optional != null) - message.proto3Optional = Boolean(object.proto3Optional); - return message; - }; - - /** - * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.extendee = ""; - object.number = 0; - object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; - object.type = options.enums === String ? "TYPE_DOUBLE" : 1; - object.typeName = ""; - object.defaultValue = ""; - object.options = null; - object.oneofIndex = 0; - object.jsonName = ""; - object.proto3Optional = false; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.extendee != null && message.hasOwnProperty("extendee")) - object.extendee = message.extendee; - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.label != null && message.hasOwnProperty("label")) - object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; - if (message.typeName != null && message.hasOwnProperty("typeName")) - object.typeName = message.typeName; - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) - object.defaultValue = message.defaultValue; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); - if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) - object.oneofIndex = message.oneofIndex; - if (message.jsonName != null && message.hasOwnProperty("jsonName")) - object.jsonName = message.jsonName; - if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) - object.proto3Optional = message.proto3Optional; - return object; - }; - - /** - * Converts this FieldDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.FieldDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - FieldDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FieldDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; - }; - - /** - * Type enum. - * @name google.protobuf.FieldDescriptorProto.Type - * @enum {number} - * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value - * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value - * @property {number} TYPE_INT64=3 TYPE_INT64 value - * @property {number} TYPE_UINT64=4 TYPE_UINT64 value - * @property {number} TYPE_INT32=5 TYPE_INT32 value - * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value - * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value - * @property {number} TYPE_BOOL=8 TYPE_BOOL value - * @property {number} TYPE_STRING=9 TYPE_STRING value - * @property {number} TYPE_GROUP=10 TYPE_GROUP value - * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value - * @property {number} TYPE_BYTES=12 TYPE_BYTES value - * @property {number} TYPE_UINT32=13 TYPE_UINT32 value - * @property {number} TYPE_ENUM=14 TYPE_ENUM value - * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value - * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value - * @property {number} TYPE_SINT32=17 TYPE_SINT32 value - * @property {number} TYPE_SINT64=18 TYPE_SINT64 value - */ - FieldDescriptorProto.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "TYPE_DOUBLE"] = 1; - values[valuesById[2] = "TYPE_FLOAT"] = 2; - values[valuesById[3] = "TYPE_INT64"] = 3; - values[valuesById[4] = "TYPE_UINT64"] = 4; - values[valuesById[5] = "TYPE_INT32"] = 5; - values[valuesById[6] = "TYPE_FIXED64"] = 6; - values[valuesById[7] = "TYPE_FIXED32"] = 7; - values[valuesById[8] = "TYPE_BOOL"] = 8; - values[valuesById[9] = "TYPE_STRING"] = 9; - values[valuesById[10] = "TYPE_GROUP"] = 10; - values[valuesById[11] = "TYPE_MESSAGE"] = 11; - values[valuesById[12] = "TYPE_BYTES"] = 12; - values[valuesById[13] = "TYPE_UINT32"] = 13; - values[valuesById[14] = "TYPE_ENUM"] = 14; - values[valuesById[15] = "TYPE_SFIXED32"] = 15; - values[valuesById[16] = "TYPE_SFIXED64"] = 16; - values[valuesById[17] = "TYPE_SINT32"] = 17; - values[valuesById[18] = "TYPE_SINT64"] = 18; - return values; - })(); - - /** - * Label enum. - * @name google.protobuf.FieldDescriptorProto.Label - * @enum {number} - * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value - * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value - * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value - */ - FieldDescriptorProto.Label = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "LABEL_OPTIONAL"] = 1; - values[valuesById[2] = "LABEL_REQUIRED"] = 2; - values[valuesById[3] = "LABEL_REPEATED"] = 3; - return values; - })(); - - return FieldDescriptorProto; - })(); - - protobuf.OneofDescriptorProto = (function() { - - /** - * Properties of an OneofDescriptorProto. - * @memberof google.protobuf - * @interface IOneofDescriptorProto - * @property {string|null} [name] OneofDescriptorProto name - * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options - */ - - /** - * Constructs a new OneofDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an OneofDescriptorProto. - * @implements IOneofDescriptorProto - * @constructor - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set - */ - function OneofDescriptorProto(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]]; - } - - /** - * OneofDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.OneofDescriptorProto - * @instance - */ - OneofDescriptorProto.prototype.name = ""; - - /** - * OneofDescriptorProto options. - * @member {google.protobuf.IOneofOptions|null|undefined} options - * @memberof google.protobuf.OneofDescriptorProto - * @instance - */ - OneofDescriptorProto.prototype.options = null; - - /** - * Creates a new OneofDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance - */ - OneofDescriptorProto.create = function create(properties) { - return new OneofDescriptorProto(properties); - }; - - /** - * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OneofDescriptorProto message. - * @function verify - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OneofDescriptorProto.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.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.OneofOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - */ - OneofDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofDescriptorProto) - return object; - var message = new $root.google.protobuf.OneofDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OneofDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this OneofDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.OneofDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - OneofDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OneofDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; - }; - - return OneofDescriptorProto; - })(); - - protobuf.EnumDescriptorProto = (function() { - - /** - * Properties of an EnumDescriptorProto. - * @memberof google.protobuf - * @interface IEnumDescriptorProto - * @property {string|null} [name] EnumDescriptorProto name - * @property {Array.|null} [value] EnumDescriptorProto value - * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options - * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange - * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName - */ - - /** - * Constructs a new EnumDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an EnumDescriptorProto. - * @implements IEnumDescriptorProto - * @constructor - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set - */ - function EnumDescriptorProto(properties) { - this.value = []; - this.reservedRange = []; - this.reservedName = []; - 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]]; - } - - /** - * EnumDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.name = ""; - - /** - * EnumDescriptorProto value. - * @member {Array.} value - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.value = $util.emptyArray; - - /** - * EnumDescriptorProto options. - * @member {google.protobuf.IEnumOptions|null|undefined} options - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.options = null; - - /** - * EnumDescriptorProto reservedRange. - * @member {Array.} reservedRange - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; - - /** - * EnumDescriptorProto reservedName. - * @member {Array.} reservedName - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.reservedName = $util.emptyArray; - - /** - * Creates a new EnumDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance - */ - EnumDescriptorProto.create = function create(properties) { - return new EnumDescriptorProto(properties); - }; - - /** - * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && message.value.length) - for (var i = 0; i < message.value.length; ++i) - $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.reservedRange != null && message.reservedRange.length) - for (var i = 0; i < message.reservedRange.length; ++i) - $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.reservedName != null && message.reservedName.length) - for (var i = 0; i < message.reservedName.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); - return writer; - }; - - /** - * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.value && message.value.length)) - message.value = []; - message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 3: { - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); - break; - } - case 4: { - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumDescriptorProto message. - * @function verify - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumDescriptorProto.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 (!Array.isArray(message.value)) - return "value: array expected"; - for (var i = 0; i < message.value.length; ++i) { - var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); - if (error) - return "value." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.EnumOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { - if (!Array.isArray(message.reservedRange)) - return "reservedRange: array expected"; - for (var i = 0; i < message.reservedRange.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); - if (error) - return "reservedRange." + error; - } - } - if (message.reservedName != null && message.hasOwnProperty("reservedName")) { - if (!Array.isArray(message.reservedName)) - return "reservedName: array expected"; - for (var i = 0; i < message.reservedName.length; ++i) - if (!$util.isString(message.reservedName[i])) - return "reservedName: string[] expected"; - } - return null; - }; - - /** - * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - */ - EnumDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumDescriptorProto) - return object; - var message = new $root.google.protobuf.EnumDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.value) { - if (!Array.isArray(object.value)) - throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); - message.value = []; - for (var i = 0; i < object.value.length; ++i) { - if (typeof object.value[i] !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); - message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); - } - if (object.reservedRange) { - if (!Array.isArray(object.reservedRange)) - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); - message.reservedRange = []; - for (var i = 0; i < object.reservedRange.length; ++i) { - if (typeof object.reservedRange[i] !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); - message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); - } - } - if (object.reservedName) { - if (!Array.isArray(object.reservedName)) - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); - message.reservedName = []; - for (var i = 0; i < object.reservedName.length; ++i) - message.reservedName[i] = String(object.reservedName[i]); - } - return message; - }; - - /** - * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.value = []; - object.reservedRange = []; - object.reservedName = []; - } - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value && message.value.length) { - object.value = []; - for (var j = 0; j < message.value.length; ++j) - object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); - if (message.reservedRange && message.reservedRange.length) { - object.reservedRange = []; - for (var j = 0; j < message.reservedRange.length; ++j) - object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); - } - if (message.reservedName && message.reservedName.length) { - object.reservedName = []; - for (var j = 0; j < message.reservedName.length; ++j) - object.reservedName[j] = message.reservedName[j]; - } - return object; - }; - - /** - * Converts this EnumDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.EnumDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - EnumDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; - }; - - EnumDescriptorProto.EnumReservedRange = (function() { - - /** - * Properties of an EnumReservedRange. - * @memberof google.protobuf.EnumDescriptorProto - * @interface IEnumReservedRange - * @property {number|null} [start] EnumReservedRange start - * @property {number|null} [end] EnumReservedRange end - */ - - /** - * Constructs a new EnumReservedRange. - * @memberof google.protobuf.EnumDescriptorProto - * @classdesc Represents an EnumReservedRange. - * @implements IEnumReservedRange - * @constructor - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set - */ - function EnumReservedRange(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]]; - } - - /** - * EnumReservedRange start. - * @member {number} start - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @instance - */ - EnumReservedRange.prototype.start = 0; - - /** - * EnumReservedRange end. - * @member {number} end - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @instance - */ - EnumReservedRange.prototype.end = 0; - - /** - * Creates a new EnumReservedRange instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance - */ - EnumReservedRange.create = function create(properties) { - return new EnumReservedRange(properties); - }; - - /** - * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumReservedRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - return writer; - }; - - /** - * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumReservedRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumReservedRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.start = reader.int32(); - break; - } - case 2: { - message.end = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumReservedRange message. - * @function verify - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumReservedRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - return null; - }; - - /** - * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange - */ - EnumReservedRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) - return object; - var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - return message; - }; - - /** - * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumReservedRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - return object; - }; - - /** - * Converts this EnumReservedRange to JSON. - * @function toJSON - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @instance - * @returns {Object.} JSON object - */ - EnumReservedRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumReservedRange - * @function getTypeUrl - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; - }; - - return EnumReservedRange; - })(); - - return EnumDescriptorProto; - })(); - - protobuf.EnumValueDescriptorProto = (function() { - - /** - * Properties of an EnumValueDescriptorProto. - * @memberof google.protobuf - * @interface IEnumValueDescriptorProto - * @property {string|null} [name] EnumValueDescriptorProto name - * @property {number|null} [number] EnumValueDescriptorProto number - * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options - */ - - /** - * Constructs a new EnumValueDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an EnumValueDescriptorProto. - * @implements IEnumValueDescriptorProto - * @constructor - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set - */ - function EnumValueDescriptorProto(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]]; - } - - /** - * EnumValueDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.name = ""; - - /** - * EnumValueDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.number = 0; - - /** - * EnumValueDescriptorProto options. - * @member {google.protobuf.IEnumValueOptions|null|undefined} options - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.options = null; - - /** - * Creates a new EnumValueDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance - */ - EnumValueDescriptorProto.create = function create(properties) { - return new EnumValueDescriptorProto(properties); - }; - - /** - * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.number = reader.int32(); - break; - } - case 3: { - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumValueDescriptorProto message. - * @function verify - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumValueDescriptorProto.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.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.EnumValueOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - */ - EnumValueDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) - return object; - var message = new $root.google.protobuf.EnumValueDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.number != null) - message.number = object.number | 0; - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumValueDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.number = 0; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this EnumValueDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - EnumValueDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumValueDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; - }; - - return EnumValueDescriptorProto; - })(); - - protobuf.ServiceDescriptorProto = (function() { - - /** - * Properties of a ServiceDescriptorProto. - * @memberof google.protobuf - * @interface IServiceDescriptorProto - * @property {string|null} [name] ServiceDescriptorProto name - * @property {Array.|null} [method] ServiceDescriptorProto method - * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options - */ - - /** - * Constructs a new ServiceDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a ServiceDescriptorProto. - * @implements IServiceDescriptorProto - * @constructor - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set - */ - function ServiceDescriptorProto(properties) { - this.method = []; - 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]]; - } - - /** - * ServiceDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.name = ""; - - /** - * ServiceDescriptorProto method. - * @member {Array.} method - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.method = $util.emptyArray; - - /** - * ServiceDescriptorProto options. - * @member {google.protobuf.IServiceOptions|null|undefined} options - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.options = null; - - /** - * Creates a new ServiceDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance - */ - ServiceDescriptorProto.create = function create(properties) { - return new ServiceDescriptorProto(properties); - }; - - /** - * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.method != null && message.method.length) - for (var i = 0; i < message.method.length; ++i) - $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.method && message.method.length)) - message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 3: { - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ServiceDescriptorProto message. - * @function verify - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ServiceDescriptorProto.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.method != null && message.hasOwnProperty("method")) { - if (!Array.isArray(message.method)) - return "method: array expected"; - for (var i = 0; i < message.method.length; ++i) { - var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); - if (error) - return "method." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ServiceOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - */ - ServiceDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceDescriptorProto) - return object; - var message = new $root.google.protobuf.ServiceDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.method) { - if (!Array.isArray(object.method)) - throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); - message.method = []; - for (var i = 0; i < object.method.length; ++i) { - if (typeof object.method[i] !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); - message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ServiceDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.method = []; - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.method && message.method.length) { - object.method = []; - for (var j = 0; j < message.method.length; ++j) - object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this ServiceDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - ServiceDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ServiceDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; - }; - - return ServiceDescriptorProto; - })(); - - protobuf.MethodDescriptorProto = (function() { - - /** - * Properties of a MethodDescriptorProto. - * @memberof google.protobuf - * @interface IMethodDescriptorProto - * @property {string|null} [name] MethodDescriptorProto name - * @property {string|null} [inputType] MethodDescriptorProto inputType - * @property {string|null} [outputType] MethodDescriptorProto outputType - * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options - * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming - * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming - */ - - /** - * Constructs a new MethodDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a MethodDescriptorProto. - * @implements IMethodDescriptorProto - * @constructor - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set - */ - function MethodDescriptorProto(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]]; - } - - /** - * MethodDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.name = ""; - - /** - * MethodDescriptorProto inputType. - * @member {string} inputType - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.inputType = ""; - - /** - * MethodDescriptorProto outputType. - * @member {string} outputType - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.outputType = ""; - - /** - * MethodDescriptorProto options. - * @member {google.protobuf.IMethodOptions|null|undefined} options - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.options = null; - - /** - * MethodDescriptorProto clientStreaming. - * @member {boolean} clientStreaming - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.clientStreaming = false; - - /** - * MethodDescriptorProto serverStreaming. - * @member {boolean} serverStreaming - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.serverStreaming = false; - - /** - * Creates a new MethodDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance - */ - MethodDescriptorProto.create = function create(properties) { - return new MethodDescriptorProto(properties); - }; - - /** - * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); - if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); - if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); - return writer; - }; - - /** - * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.inputType = reader.string(); - break; - } - case 3: { - message.outputType = reader.string(); - break; - } - case 4: { - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); - break; - } - case 5: { - message.clientStreaming = reader.bool(); - break; - } - case 6: { - message.serverStreaming = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MethodDescriptorProto message. - * @function verify - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodDescriptorProto.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.inputType != null && message.hasOwnProperty("inputType")) - if (!$util.isString(message.inputType)) - return "inputType: string expected"; - if (message.outputType != null && message.hasOwnProperty("outputType")) - if (!$util.isString(message.outputType)) - return "outputType: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.MethodOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) - if (typeof message.clientStreaming !== "boolean") - return "clientStreaming: boolean expected"; - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) - if (typeof message.serverStreaming !== "boolean") - return "serverStreaming: boolean expected"; - return null; - }; - - /** - * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - */ - MethodDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodDescriptorProto) - return object; - var message = new $root.google.protobuf.MethodDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.inputType != null) - message.inputType = String(object.inputType); - if (object.outputType != null) - message.outputType = String(object.outputType); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); - } - if (object.clientStreaming != null) - message.clientStreaming = Boolean(object.clientStreaming); - if (object.serverStreaming != null) - message.serverStreaming = Boolean(object.serverStreaming); - return message; - }; - - /** - * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MethodDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.inputType = ""; - object.outputType = ""; - object.options = null; - object.clientStreaming = false; - object.serverStreaming = false; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.inputType != null && message.hasOwnProperty("inputType")) - object.inputType = message.inputType; - if (message.outputType != null && message.hasOwnProperty("outputType")) - object.outputType = message.outputType; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); - if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) - object.clientStreaming = message.clientStreaming; - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) - object.serverStreaming = message.serverStreaming; - return object; - }; - - /** - * Converts this MethodDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.MethodDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - MethodDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MethodDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; - }; - - return MethodDescriptorProto; - })(); - - protobuf.FileOptions = (function() { - - /** - * Properties of a FileOptions. - * @memberof google.protobuf - * @interface IFileOptions - * @property {string|null} [javaPackage] FileOptions javaPackage - * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname - * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles - * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash - * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 - * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor - * @property {string|null} [goPackage] FileOptions goPackage - * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices - * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices - * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices - * @property {boolean|null} [phpGenericServices] FileOptions phpGenericServices - * @property {boolean|null} [deprecated] FileOptions deprecated - * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas - * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix - * @property {string|null} [csharpNamespace] FileOptions csharpNamespace - * @property {string|null} [swiftPrefix] FileOptions swiftPrefix - * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix - * @property {string|null} [phpNamespace] FileOptions phpNamespace - * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace - * @property {string|null} [rubyPackage] FileOptions rubyPackage - * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption - * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition - */ - - /** - * Constructs a new FileOptions. - * @memberof google.protobuf - * @classdesc Represents a FileOptions. - * @implements IFileOptions - * @constructor - * @param {google.protobuf.IFileOptions=} [properties] Properties to set - */ - function FileOptions(properties) { - this.uninterpretedOption = []; - this[".google.api.resourceDefinition"] = []; - 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]]; - } - - /** - * FileOptions javaPackage. - * @member {string} javaPackage - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaPackage = ""; - - /** - * FileOptions javaOuterClassname. - * @member {string} javaOuterClassname - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaOuterClassname = ""; - - /** - * FileOptions javaMultipleFiles. - * @member {boolean} javaMultipleFiles - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaMultipleFiles = false; - - /** - * FileOptions javaGenerateEqualsAndHash. - * @member {boolean} javaGenerateEqualsAndHash - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaGenerateEqualsAndHash = false; - - /** - * FileOptions javaStringCheckUtf8. - * @member {boolean} javaStringCheckUtf8 - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaStringCheckUtf8 = false; - - /** - * FileOptions optimizeFor. - * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.optimizeFor = 1; - - /** - * FileOptions goPackage. - * @member {string} goPackage - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.goPackage = ""; - - /** - * FileOptions ccGenericServices. - * @member {boolean} ccGenericServices - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.ccGenericServices = false; - - /** - * FileOptions javaGenericServices. - * @member {boolean} javaGenericServices - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaGenericServices = false; - - /** - * FileOptions pyGenericServices. - * @member {boolean} pyGenericServices - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.pyGenericServices = false; - - /** - * FileOptions phpGenericServices. - * @member {boolean} phpGenericServices - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.phpGenericServices = false; - - /** - * FileOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.deprecated = false; - - /** - * FileOptions ccEnableArenas. - * @member {boolean} ccEnableArenas - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.ccEnableArenas = true; - - /** - * FileOptions objcClassPrefix. - * @member {string} objcClassPrefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.objcClassPrefix = ""; - - /** - * FileOptions csharpNamespace. - * @member {string} csharpNamespace - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.csharpNamespace = ""; - - /** - * FileOptions swiftPrefix. - * @member {string} swiftPrefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.swiftPrefix = ""; - - /** - * FileOptions phpClassPrefix. - * @member {string} phpClassPrefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.phpClassPrefix = ""; - - /** - * FileOptions phpNamespace. - * @member {string} phpNamespace - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.phpNamespace = ""; - - /** - * FileOptions phpMetadataNamespace. - * @member {string} phpMetadataNamespace - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.phpMetadataNamespace = ""; - - /** - * FileOptions rubyPackage. - * @member {string} rubyPackage - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.rubyPackage = ""; - - /** - * FileOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * FileOptions .google.api.resourceDefinition. - * @member {Array.} .google.api.resourceDefinition - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; - - /** - * Creates a new FileOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions=} [properties] Properties to set - * @returns {google.protobuf.FileOptions} FileOptions instance - */ - FileOptions.create = function create(properties) { - return new FileOptions(properties); - }; - - /** - * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); - if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); - if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); - if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); - if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); - if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) - writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); - if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) - writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); - if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) - writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); - if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) - writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); - if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) - writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); - if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) - writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); - if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) - writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); - if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) - writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); - if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) - writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); - if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) - writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); - if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) - writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); - if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) - writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); - if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) - writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); - if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) - writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) - for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) - $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileOptions} FileOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.javaPackage = reader.string(); - break; - } - case 8: { - message.javaOuterClassname = reader.string(); - break; - } - case 10: { - message.javaMultipleFiles = reader.bool(); - break; - } - case 20: { - message.javaGenerateEqualsAndHash = reader.bool(); - break; - } - case 27: { - message.javaStringCheckUtf8 = reader.bool(); - break; - } - case 9: { - message.optimizeFor = reader.int32(); - break; - } - case 11: { - message.goPackage = reader.string(); - break; - } - case 16: { - message.ccGenericServices = reader.bool(); - break; - } - case 17: { - message.javaGenericServices = reader.bool(); - break; - } - case 18: { - message.pyGenericServices = reader.bool(); - break; - } - case 42: { - message.phpGenericServices = reader.bool(); - break; - } - case 23: { - message.deprecated = reader.bool(); - break; - } - case 31: { - message.ccEnableArenas = reader.bool(); - break; - } - case 36: { - message.objcClassPrefix = reader.string(); - break; - } - case 37: { - message.csharpNamespace = reader.string(); - break; - } - case 39: { - message.swiftPrefix = reader.string(); - break; - } - case 40: { - message.phpClassPrefix = reader.string(); - break; - } - case 41: { - message.phpNamespace = reader.string(); - break; - } - case 44: { - message.phpMetadataNamespace = reader.string(); - break; - } - case 45: { - message.rubyPackage = reader.string(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1053: { - if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) - message[".google.api.resourceDefinition"] = []; - message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileOptions} FileOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileOptions message. - * @function verify - * @memberof google.protobuf.FileOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) - if (!$util.isString(message.javaPackage)) - return "javaPackage: string expected"; - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) - if (!$util.isString(message.javaOuterClassname)) - return "javaOuterClassname: string expected"; - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) - if (typeof message.javaMultipleFiles !== "boolean") - return "javaMultipleFiles: boolean expected"; - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) - if (typeof message.javaGenerateEqualsAndHash !== "boolean") - return "javaGenerateEqualsAndHash: boolean expected"; - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) - if (typeof message.javaStringCheckUtf8 !== "boolean") - return "javaStringCheckUtf8: boolean expected"; - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - switch (message.optimizeFor) { - default: - return "optimizeFor: enum value expected"; - case 1: - case 2: - case 3: - break; - } - if (message.goPackage != null && message.hasOwnProperty("goPackage")) - if (!$util.isString(message.goPackage)) - return "goPackage: string expected"; - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) - if (typeof message.ccGenericServices !== "boolean") - return "ccGenericServices: boolean expected"; - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) - if (typeof message.javaGenericServices !== "boolean") - return "javaGenericServices: boolean expected"; - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) - if (typeof message.pyGenericServices !== "boolean") - return "pyGenericServices: boolean expected"; - if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) - if (typeof message.phpGenericServices !== "boolean") - return "phpGenericServices: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) - if (typeof message.ccEnableArenas !== "boolean") - return "ccEnableArenas: boolean expected"; - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) - if (!$util.isString(message.objcClassPrefix)) - return "objcClassPrefix: string expected"; - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) - if (!$util.isString(message.csharpNamespace)) - return "csharpNamespace: string expected"; - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) - if (!$util.isString(message.swiftPrefix)) - return "swiftPrefix: string expected"; - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) - if (!$util.isString(message.phpClassPrefix)) - return "phpClassPrefix: string expected"; - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) - if (!$util.isString(message.phpNamespace)) - return "phpNamespace: string expected"; - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) - if (!$util.isString(message.phpMetadataNamespace)) - return "phpMetadataNamespace: string expected"; - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) - if (!$util.isString(message.rubyPackage)) - return "rubyPackage: string expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { - if (!Array.isArray(message[".google.api.resourceDefinition"])) - return ".google.api.resourceDefinition: array expected"; - for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { - var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); - if (error) - return ".google.api.resourceDefinition." + error; - } - } - return null; - }; - - /** - * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileOptions} FileOptions - */ - FileOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileOptions) - return object; - var message = new $root.google.protobuf.FileOptions(); - if (object.javaPackage != null) - message.javaPackage = String(object.javaPackage); - if (object.javaOuterClassname != null) - message.javaOuterClassname = String(object.javaOuterClassname); - if (object.javaMultipleFiles != null) - message.javaMultipleFiles = Boolean(object.javaMultipleFiles); - if (object.javaGenerateEqualsAndHash != null) - message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); - if (object.javaStringCheckUtf8 != null) - message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); - switch (object.optimizeFor) { - default: - if (typeof object.optimizeFor === "number") { - message.optimizeFor = object.optimizeFor; - break; - } - break; - case "SPEED": - case 1: - message.optimizeFor = 1; - break; - case "CODE_SIZE": - case 2: - message.optimizeFor = 2; - break; - case "LITE_RUNTIME": - case 3: - message.optimizeFor = 3; - break; - } - if (object.goPackage != null) - message.goPackage = String(object.goPackage); - if (object.ccGenericServices != null) - message.ccGenericServices = Boolean(object.ccGenericServices); - if (object.javaGenericServices != null) - message.javaGenericServices = Boolean(object.javaGenericServices); - if (object.pyGenericServices != null) - message.pyGenericServices = Boolean(object.pyGenericServices); - if (object.phpGenericServices != null) - message.phpGenericServices = Boolean(object.phpGenericServices); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.ccEnableArenas != null) - message.ccEnableArenas = Boolean(object.ccEnableArenas); - if (object.objcClassPrefix != null) - message.objcClassPrefix = String(object.objcClassPrefix); - if (object.csharpNamespace != null) - message.csharpNamespace = String(object.csharpNamespace); - if (object.swiftPrefix != null) - message.swiftPrefix = String(object.swiftPrefix); - if (object.phpClassPrefix != null) - message.phpClassPrefix = String(object.phpClassPrefix); - if (object.phpNamespace != null) - message.phpNamespace = String(object.phpNamespace); - if (object.phpMetadataNamespace != null) - message.phpMetadataNamespace = String(object.phpMetadataNamespace); - if (object.rubyPackage != null) - message.rubyPackage = String(object.rubyPackage); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.resourceDefinition"]) { - if (!Array.isArray(object[".google.api.resourceDefinition"])) - throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); - message[".google.api.resourceDefinition"] = []; - for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { - if (typeof object[".google.api.resourceDefinition"][i] !== "object") - throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); - message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FileOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.FileOptions} message FileOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.uninterpretedOption = []; - object[".google.api.resourceDefinition"] = []; - } - if (options.defaults) { - object.javaPackage = ""; - object.javaOuterClassname = ""; - object.optimizeFor = options.enums === String ? "SPEED" : 1; - object.javaMultipleFiles = false; - object.goPackage = ""; - object.ccGenericServices = false; - object.javaGenericServices = false; - object.pyGenericServices = false; - object.javaGenerateEqualsAndHash = false; - object.deprecated = false; - object.javaStringCheckUtf8 = false; - object.ccEnableArenas = true; - object.objcClassPrefix = ""; - object.csharpNamespace = ""; - object.swiftPrefix = ""; - object.phpClassPrefix = ""; - object.phpNamespace = ""; - object.phpGenericServices = false; - object.phpMetadataNamespace = ""; - object.rubyPackage = ""; - } - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) - object.javaPackage = message.javaPackage; - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) - object.javaOuterClassname = message.javaOuterClassname; - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) - object.javaMultipleFiles = message.javaMultipleFiles; - if (message.goPackage != null && message.hasOwnProperty("goPackage")) - object.goPackage = message.goPackage; - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) - object.ccGenericServices = message.ccGenericServices; - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) - object.javaGenericServices = message.javaGenericServices; - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) - object.pyGenericServices = message.pyGenericServices; - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) - object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) - object.javaStringCheckUtf8 = message.javaStringCheckUtf8; - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) - object.ccEnableArenas = message.ccEnableArenas; - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) - object.objcClassPrefix = message.objcClassPrefix; - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) - object.csharpNamespace = message.csharpNamespace; - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) - object.swiftPrefix = message.swiftPrefix; - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) - object.phpClassPrefix = message.phpClassPrefix; - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) - object.phpNamespace = message.phpNamespace; - if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) - object.phpGenericServices = message.phpGenericServices; - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) - object.phpMetadataNamespace = message.phpMetadataNamespace; - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) - object.rubyPackage = message.rubyPackage; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { - object[".google.api.resourceDefinition"] = []; - for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) - object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); - } - return object; - }; - - /** - * Converts this FileOptions to JSON. - * @function toJSON - * @memberof google.protobuf.FileOptions - * @instance - * @returns {Object.} JSON object - */ - FileOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FileOptions - * @function getTypeUrl - * @memberof google.protobuf.FileOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FileOptions"; - }; - - /** - * OptimizeMode enum. - * @name google.protobuf.FileOptions.OptimizeMode - * @enum {number} - * @property {number} SPEED=1 SPEED value - * @property {number} CODE_SIZE=2 CODE_SIZE value - * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value - */ - FileOptions.OptimizeMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "SPEED"] = 1; - values[valuesById[2] = "CODE_SIZE"] = 2; - values[valuesById[3] = "LITE_RUNTIME"] = 3; - return values; - })(); - - return FileOptions; - })(); - - protobuf.MessageOptions = (function() { - - /** - * Properties of a MessageOptions. - * @memberof google.protobuf - * @interface IMessageOptions - * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat - * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor - * @property {boolean|null} [deprecated] MessageOptions deprecated - * @property {boolean|null} [mapEntry] MessageOptions mapEntry - * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption - * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource - */ - - /** - * Constructs a new MessageOptions. - * @memberof google.protobuf - * @classdesc Represents a MessageOptions. - * @implements IMessageOptions - * @constructor - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set - */ - function MessageOptions(properties) { - this.uninterpretedOption = []; - 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]]; - } - - /** - * MessageOptions messageSetWireFormat. - * @member {boolean} messageSetWireFormat - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.messageSetWireFormat = false; - - /** - * MessageOptions noStandardDescriptorAccessor. - * @member {boolean} noStandardDescriptorAccessor - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.noStandardDescriptorAccessor = false; - - /** - * MessageOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.deprecated = false; - - /** - * MessageOptions mapEntry. - * @member {boolean} mapEntry - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.mapEntry = false; - - /** - * MessageOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * MessageOptions .google.api.resource. - * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".google.api.resource"] = null; - - /** - * Creates a new MessageOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set - * @returns {google.protobuf.MessageOptions} MessageOptions instance - */ - MessageOptions.create = function create(properties) { - return new MessageOptions(properties); - }; - - /** - * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MessageOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); - if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) - writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) - $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MessageOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MessageOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MessageOptions} MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MessageOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.messageSetWireFormat = reader.bool(); - break; - } - case 2: { - message.noStandardDescriptorAccessor = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 7: { - message.mapEntry = reader.bool(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1053: { - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MessageOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MessageOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MessageOptions} MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MessageOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MessageOptions message. - * @function verify - * @memberof google.protobuf.MessageOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MessageOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) - if (typeof message.messageSetWireFormat !== "boolean") - return "messageSetWireFormat: boolean expected"; - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) - if (typeof message.noStandardDescriptorAccessor !== "boolean") - return "noStandardDescriptorAccessor: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) - if (typeof message.mapEntry !== "boolean") - return "mapEntry: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { - var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); - if (error) - return ".google.api.resource." + error; - } - return null; - }; - - /** - * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MessageOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MessageOptions} MessageOptions - */ - MessageOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MessageOptions) - return object; - var message = new $root.google.protobuf.MessageOptions(); - if (object.messageSetWireFormat != null) - message.messageSetWireFormat = Boolean(object.messageSetWireFormat); - if (object.noStandardDescriptorAccessor != null) - message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.mapEntry != null) - message.mapEntry = Boolean(object.mapEntry); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.resource"] != null) { - if (typeof object[".google.api.resource"] !== "object") - throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); - } - return message; - }; - - /** - * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.MessageOptions} message MessageOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MessageOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.messageSetWireFormat = false; - object.noStandardDescriptorAccessor = false; - object.deprecated = false; - object.mapEntry = false; - object[".google.api.resource"] = null; - } - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) - object.messageSetWireFormat = message.messageSetWireFormat; - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) - object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) - object.mapEntry = message.mapEntry; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) - object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); - return object; - }; - - /** - * Converts this MessageOptions to JSON. - * @function toJSON - * @memberof google.protobuf.MessageOptions - * @instance - * @returns {Object.} JSON object - */ - MessageOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MessageOptions - * @function getTypeUrl - * @memberof google.protobuf.MessageOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.MessageOptions"; - }; - - return MessageOptions; - })(); - - protobuf.FieldOptions = (function() { - - /** - * Properties of a FieldOptions. - * @memberof google.protobuf - * @interface IFieldOptions - * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype - * @property {boolean|null} [packed] FieldOptions packed - * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype - * @property {boolean|null} [lazy] FieldOptions lazy - * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy - * @property {boolean|null} [deprecated] FieldOptions deprecated - * @property {boolean|null} [weak] FieldOptions weak - * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption - * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior - * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference - */ - - /** - * Constructs a new FieldOptions. - * @memberof google.protobuf - * @classdesc Represents a FieldOptions. - * @implements IFieldOptions - * @constructor - * @param {google.protobuf.IFieldOptions=} [properties] Properties to set - */ - function FieldOptions(properties) { - this.uninterpretedOption = []; - this[".google.api.fieldBehavior"] = []; - 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]]; - } - - /** - * FieldOptions ctype. - * @member {google.protobuf.FieldOptions.CType} ctype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.ctype = 0; - - /** - * FieldOptions packed. - * @member {boolean} packed - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.packed = false; - - /** - * FieldOptions jstype. - * @member {google.protobuf.FieldOptions.JSType} jstype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.jstype = 0; - - /** - * FieldOptions lazy. - * @member {boolean} lazy - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.lazy = false; - - /** - * FieldOptions unverifiedLazy. - * @member {boolean} unverifiedLazy - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.unverifiedLazy = false; - - /** - * FieldOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.deprecated = false; - - /** - * FieldOptions weak. - * @member {boolean} weak - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.weak = false; - - /** - * FieldOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * FieldOptions .google.api.fieldBehavior. - * @member {Array.} .google.api.fieldBehavior - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; - - /** - * FieldOptions .google.api.resourceReference. - * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".google.api.resourceReference"] = null; - - /** - * Creates a new FieldOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.IFieldOptions=} [properties] Properties to set - * @returns {google.protobuf.FieldOptions} FieldOptions instance - */ - FieldOptions.create = function create(properties) { - return new FieldOptions(properties); - }; - - /** - * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); - if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); - if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); - if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); - if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) - writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) { - writer.uint32(/* id 1052, wireType 2 =*/8418).fork(); - for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) - writer.int32(message[".google.api.fieldBehavior"][i]); - writer.ldelim(); - } - if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) - $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions} FieldOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.ctype = reader.int32(); - break; - } - case 2: { - message.packed = reader.bool(); - break; - } - case 6: { - message.jstype = reader.int32(); - break; - } - case 5: { - message.lazy = reader.bool(); - break; - } - case 15: { - message.unverifiedLazy = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 10: { - message.weak = reader.bool(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1052: { - if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) - message[".google.api.fieldBehavior"] = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message[".google.api.fieldBehavior"].push(reader.int32()); - } else - message[".google.api.fieldBehavior"].push(reader.int32()); - break; - } - case 1055: { - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions} FieldOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldOptions message. - * @function verify - * @memberof google.protobuf.FieldOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ctype != null && message.hasOwnProperty("ctype")) - switch (message.ctype) { - default: - return "ctype: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.packed != null && message.hasOwnProperty("packed")) - if (typeof message.packed !== "boolean") - return "packed: boolean expected"; - if (message.jstype != null && message.hasOwnProperty("jstype")) - switch (message.jstype) { - default: - return "jstype: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.lazy != null && message.hasOwnProperty("lazy")) - if (typeof message.lazy !== "boolean") - return "lazy: boolean expected"; - if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) - if (typeof message.unverifiedLazy !== "boolean") - return "unverifiedLazy: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.weak != null && message.hasOwnProperty("weak")) - if (typeof message.weak !== "boolean") - return "weak: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { - if (!Array.isArray(message[".google.api.fieldBehavior"])) - return ".google.api.fieldBehavior: array expected"; - for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) - switch (message[".google.api.fieldBehavior"][i]) { - default: - return ".google.api.fieldBehavior: enum value[] expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { - var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); - if (error) - return ".google.api.resourceReference." + error; - } - return null; - }; - - /** - * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions} FieldOptions - */ - FieldOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions) - return object; - var message = new $root.google.protobuf.FieldOptions(); - switch (object.ctype) { - default: - if (typeof object.ctype === "number") { - message.ctype = object.ctype; - break; - } - break; - case "STRING": - case 0: - message.ctype = 0; - break; - case "CORD": - case 1: - message.ctype = 1; - break; - case "STRING_PIECE": - case 2: - message.ctype = 2; - break; - } - if (object.packed != null) - message.packed = Boolean(object.packed); - switch (object.jstype) { - default: - if (typeof object.jstype === "number") { - message.jstype = object.jstype; - break; - } - break; - case "JS_NORMAL": - case 0: - message.jstype = 0; - break; - case "JS_STRING": - case 1: - message.jstype = 1; - break; - case "JS_NUMBER": - case 2: - message.jstype = 2; - break; - } - if (object.lazy != null) - message.lazy = Boolean(object.lazy); - if (object.unverifiedLazy != null) - message.unverifiedLazy = Boolean(object.unverifiedLazy); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.weak != null) - message.weak = Boolean(object.weak); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.fieldBehavior"]) { - if (!Array.isArray(object[".google.api.fieldBehavior"])) - throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); - message[".google.api.fieldBehavior"] = []; - for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) - switch (object[".google.api.fieldBehavior"][i]) { - default: - if (typeof object[".google.api.fieldBehavior"][i] === "number") { - message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; - break; - } - case "FIELD_BEHAVIOR_UNSPECIFIED": - case 0: - message[".google.api.fieldBehavior"][i] = 0; - break; - case "OPTIONAL": - case 1: - message[".google.api.fieldBehavior"][i] = 1; - break; - case "REQUIRED": - case 2: - message[".google.api.fieldBehavior"][i] = 2; - break; - case "OUTPUT_ONLY": - case 3: - message[".google.api.fieldBehavior"][i] = 3; - break; - case "INPUT_ONLY": - case 4: - message[".google.api.fieldBehavior"][i] = 4; - break; - case "IMMUTABLE": - case 5: - message[".google.api.fieldBehavior"][i] = 5; - break; - case "UNORDERED_LIST": - case 6: - message[".google.api.fieldBehavior"][i] = 6; - break; - case "NON_EMPTY_DEFAULT": - case 7: - message[".google.api.fieldBehavior"][i] = 7; - break; - } - } - if (object[".google.api.resourceReference"] != null) { - if (typeof object[".google.api.resourceReference"] !== "object") - throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); - } - return message; - }; - - /** - * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.FieldOptions} message FieldOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.uninterpretedOption = []; - object[".google.api.fieldBehavior"] = []; - } - if (options.defaults) { - object.ctype = options.enums === String ? "STRING" : 0; - object.packed = false; - object.deprecated = false; - object.lazy = false; - object.jstype = options.enums === String ? "JS_NORMAL" : 0; - object.weak = false; - object.unverifiedLazy = false; - object[".google.api.resourceReference"] = null; - } - if (message.ctype != null && message.hasOwnProperty("ctype")) - object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; - if (message.packed != null && message.hasOwnProperty("packed")) - object.packed = message.packed; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.lazy != null && message.hasOwnProperty("lazy")) - object.lazy = message.lazy; - if (message.jstype != null && message.hasOwnProperty("jstype")) - object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; - if (message.weak != null && message.hasOwnProperty("weak")) - object.weak = message.weak; - if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) - object.unverifiedLazy = message.unverifiedLazy; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { - object[".google.api.fieldBehavior"] = []; - for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) - object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; - } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) - object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); - return object; - }; - - /** - * Converts this FieldOptions to JSON. - * @function toJSON - * @memberof google.protobuf.FieldOptions - * @instance - * @returns {Object.} JSON object - */ - FieldOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FieldOptions - * @function getTypeUrl - * @memberof google.protobuf.FieldOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldOptions"; - }; - - /** - * CType enum. - * @name google.protobuf.FieldOptions.CType - * @enum {number} - * @property {number} STRING=0 STRING value - * @property {number} CORD=1 CORD value - * @property {number} STRING_PIECE=2 STRING_PIECE value - */ - FieldOptions.CType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STRING"] = 0; - values[valuesById[1] = "CORD"] = 1; - values[valuesById[2] = "STRING_PIECE"] = 2; - return values; - })(); - - /** - * JSType enum. - * @name google.protobuf.FieldOptions.JSType - * @enum {number} - * @property {number} JS_NORMAL=0 JS_NORMAL value - * @property {number} JS_STRING=1 JS_STRING value - * @property {number} JS_NUMBER=2 JS_NUMBER value - */ - FieldOptions.JSType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "JS_NORMAL"] = 0; - values[valuesById[1] = "JS_STRING"] = 1; - values[valuesById[2] = "JS_NUMBER"] = 2; - return values; - })(); - - return FieldOptions; - })(); - - protobuf.OneofOptions = (function() { - - /** - * Properties of an OneofOptions. - * @memberof google.protobuf - * @interface IOneofOptions - * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption - */ - - /** - * Constructs a new OneofOptions. - * @memberof google.protobuf - * @classdesc Represents an OneofOptions. - * @implements IOneofOptions - * @constructor - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set - */ - function OneofOptions(properties) { - this.uninterpretedOption = []; - 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]]; - } - - /** - * OneofOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.OneofOptions - * @instance - */ - OneofOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * Creates a new OneofOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set - * @returns {google.protobuf.OneofOptions} OneofOptions instance - */ - OneofOptions.create = function create(properties) { - return new OneofOptions(properties); - }; - - /** - * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OneofOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.OneofOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofOptions} OneofOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OneofOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.OneofOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofOptions} OneofOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OneofOptions message. - * @function verify - * @memberof google.protobuf.OneofOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OneofOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - return null; - }; - - /** - * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.OneofOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.OneofOptions} OneofOptions - */ - OneofOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofOptions) - return object; - var message = new $root.google.protobuf.OneofOptions(); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.OneofOptions} message OneofOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OneofOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; - - /** - * Converts this OneofOptions to JSON. - * @function toJSON - * @memberof google.protobuf.OneofOptions - * @instance - * @returns {Object.} JSON object - */ - OneofOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OneofOptions - * @function getTypeUrl - * @memberof google.protobuf.OneofOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.OneofOptions"; - }; - - return OneofOptions; - })(); - - protobuf.EnumOptions = (function() { - - /** - * Properties of an EnumOptions. - * @memberof google.protobuf - * @interface IEnumOptions - * @property {boolean|null} [allowAlias] EnumOptions allowAlias - * @property {boolean|null} [deprecated] EnumOptions deprecated - * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption - */ - - /** - * Constructs a new EnumOptions. - * @memberof google.protobuf - * @classdesc Represents an EnumOptions. - * @implements IEnumOptions - * @constructor - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set - */ - function EnumOptions(properties) { - this.uninterpretedOption = []; - 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]]; - } - - /** - * EnumOptions allowAlias. - * @member {boolean} allowAlias - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.allowAlias = false; - - /** - * EnumOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.deprecated = false; - - /** - * EnumOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * Creates a new EnumOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set - * @returns {google.protobuf.EnumOptions} EnumOptions instance - */ - EnumOptions.create = function create(properties) { - return new EnumOptions(properties); - }; - - /** - * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumOptions} EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - message.allowAlias = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumOptions} EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumOptions message. - * @function verify - * @memberof google.protobuf.EnumOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) - if (typeof message.allowAlias !== "boolean") - return "allowAlias: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - return null; - }; - - /** - * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumOptions} EnumOptions - */ - EnumOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumOptions) - return object; - var message = new $root.google.protobuf.EnumOptions(); - if (object.allowAlias != null) - message.allowAlias = Boolean(object.allowAlias); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.EnumOptions} message EnumOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.allowAlias = false; - object.deprecated = false; - } - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) - object.allowAlias = message.allowAlias; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; - - /** - * Converts this EnumOptions to JSON. - * @function toJSON - * @memberof google.protobuf.EnumOptions - * @instance - * @returns {Object.} JSON object - */ - EnumOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumOptions - * @function getTypeUrl - * @memberof google.protobuf.EnumOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumOptions"; - }; - - return EnumOptions; - })(); - - protobuf.EnumValueOptions = (function() { - - /** - * Properties of an EnumValueOptions. - * @memberof google.protobuf - * @interface IEnumValueOptions - * @property {boolean|null} [deprecated] EnumValueOptions deprecated - * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption - */ - - /** - * Constructs a new EnumValueOptions. - * @memberof google.protobuf - * @classdesc Represents an EnumValueOptions. - * @implements IEnumValueOptions - * @constructor - * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set - */ - function EnumValueOptions(properties) { - this.uninterpretedOption = []; - 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]]; - } - - /** - * EnumValueOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.deprecated = false; - - /** - * EnumValueOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * Creates a new EnumValueOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance - */ - EnumValueOptions.create = function create(properties) { - return new EnumValueOptions(properties); - }; - - /** - * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.deprecated = reader.bool(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumValueOptions message. - * @function verify - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumValueOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - return null; - }; - - /** - * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - */ - EnumValueOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueOptions) - return object; - var message = new $root.google.protobuf.EnumValueOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.EnumValueOptions} message EnumValueOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumValueOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) - object.deprecated = false; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; - - /** - * Converts this EnumValueOptions to JSON. - * @function toJSON - * @memberof google.protobuf.EnumValueOptions - * @instance - * @returns {Object.} JSON object - */ - EnumValueOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumValueOptions - * @function getTypeUrl - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; - }; - - return EnumValueOptions; - })(); - - protobuf.ServiceOptions = (function() { - - /** - * Properties of a ServiceOptions. - * @memberof google.protobuf - * @interface IServiceOptions - * @property {boolean|null} [deprecated] ServiceOptions deprecated - * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption - * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost - * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes - */ - - /** - * Constructs a new ServiceOptions. - * @memberof google.protobuf - * @classdesc Represents a ServiceOptions. - * @implements IServiceOptions - * @constructor - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set - */ - function ServiceOptions(properties) { - this.uninterpretedOption = []; - 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]]; - } - - /** - * ServiceOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.deprecated = false; - - /** - * ServiceOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * ServiceOptions .google.api.defaultHost. - * @member {string} .google.api.defaultHost - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype[".google.api.defaultHost"] = ""; - - /** - * ServiceOptions .google.api.oauthScopes. - * @member {string} .google.api.oauthScopes - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype[".google.api.oauthScopes"] = ""; - - /** - * Creates a new ServiceOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set - * @returns {google.protobuf.ServiceOptions} ServiceOptions instance - */ - ServiceOptions.create = function create(properties) { - return new ServiceOptions(properties); - }; - - /** - * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) - writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); - if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) - writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); - return writer; - }; - - /** - * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ServiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceOptions} ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 33: { - message.deprecated = reader.bool(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1049: { - message[".google.api.defaultHost"] = reader.string(); - break; - } - case 1050: { - message[".google.api.oauthScopes"] = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ServiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceOptions} ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ServiceOptions message. - * @function verify - * @memberof google.protobuf.ServiceOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ServiceOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) - if (!$util.isString(message[".google.api.defaultHost"])) - return ".google.api.defaultHost: string expected"; - if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) - if (!$util.isString(message[".google.api.oauthScopes"])) - return ".google.api.oauthScopes: string expected"; - return null; - }; - - /** - * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ServiceOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceOptions} ServiceOptions - */ - ServiceOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceOptions) - return object; - var message = new $root.google.protobuf.ServiceOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.defaultHost"] != null) - message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); - if (object[".google.api.oauthScopes"] != null) - message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); - return message; - }; - - /** - * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.ServiceOptions} message ServiceOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ServiceOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.deprecated = false; - object[".google.api.defaultHost"] = ""; - object[".google.api.oauthScopes"] = ""; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) - object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; - if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) - object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; - return object; - }; - - /** - * Converts this ServiceOptions to JSON. - * @function toJSON - * @memberof google.protobuf.ServiceOptions - * @instance - * @returns {Object.} JSON object - */ - ServiceOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ServiceOptions - * @function getTypeUrl - * @memberof google.protobuf.ServiceOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ServiceOptions"; - }; - - return ServiceOptions; - })(); - - protobuf.MethodOptions = (function() { - - /** - * Properties of a MethodOptions. - * @memberof google.protobuf - * @interface IMethodOptions - * @property {boolean|null} [deprecated] MethodOptions deprecated - * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel - * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption - * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http - * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature - * @property {google.longrunning.IOperationInfo|null} [".google.longrunning.operationInfo"] MethodOptions .google.longrunning.operationInfo - */ - - /** - * Constructs a new MethodOptions. - * @memberof google.protobuf - * @classdesc Represents a MethodOptions. - * @implements IMethodOptions - * @constructor - * @param {google.protobuf.IMethodOptions=} [properties] Properties to set - */ - function MethodOptions(properties) { - this.uninterpretedOption = []; - this[".google.api.methodSignature"] = []; - 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]]; - } - - /** - * MethodOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.deprecated = false; - - /** - * MethodOptions idempotencyLevel. - * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.idempotencyLevel = 0; - - /** - * MethodOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * MethodOptions .google.api.http. - * @member {google.api.IHttpRule|null|undefined} .google.api.http - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype[".google.api.http"] = null; - - /** - * MethodOptions .google.api.methodSignature. - * @member {Array.} .google.api.methodSignature - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; - - /** - * MethodOptions .google.longrunning.operationInfo. - * @member {google.longrunning.IOperationInfo|null|undefined} .google.longrunning.operationInfo - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype[".google.longrunning.operationInfo"] = null; - - /** - * Creates a new MethodOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.IMethodOptions=} [properties] Properties to set - * @returns {google.protobuf.MethodOptions} MethodOptions instance - */ - MethodOptions.create = function create(properties) { - return new MethodOptions(properties); - }; - - /** - * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) - writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) - $root.google.longrunning.OperationInfo.encode(message[".google.longrunning.operationInfo"], writer.uint32(/* id 1049, wireType 2 =*/8394).fork()).ldelim(); - if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) - for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) - writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); - if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) - $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MethodOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MethodOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodOptions} MethodOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 33: { - message.deprecated = reader.bool(); - break; - } - case 34: { - message.idempotencyLevel = reader.int32(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 72295728: { - message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); - break; - } - case 1051: { - if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) - message[".google.api.methodSignature"] = []; - message[".google.api.methodSignature"].push(reader.string()); - break; - } - case 1049: { - message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MethodOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MethodOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodOptions} MethodOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MethodOptions message. - * @function verify - * @memberof google.protobuf.MethodOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - switch (message.idempotencyLevel) { - default: - return "idempotencyLevel: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { - var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); - if (error) - return ".google.api.http." + error; - } - if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { - if (!Array.isArray(message[".google.api.methodSignature"])) - return ".google.api.methodSignature: array expected"; - for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) - if (!$util.isString(message[".google.api.methodSignature"][i])) - return ".google.api.methodSignature: string[] expected"; - } - if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) { - var error = $root.google.longrunning.OperationInfo.verify(message[".google.longrunning.operationInfo"]); - if (error) - return ".google.longrunning.operationInfo." + error; - } - return null; - }; - - /** - * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MethodOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MethodOptions} MethodOptions - */ - MethodOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodOptions) - return object; - var message = new $root.google.protobuf.MethodOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - switch (object.idempotencyLevel) { - default: - if (typeof object.idempotencyLevel === "number") { - message.idempotencyLevel = object.idempotencyLevel; - break; - } - break; - case "IDEMPOTENCY_UNKNOWN": - case 0: - message.idempotencyLevel = 0; - break; - case "NO_SIDE_EFFECTS": - case 1: - message.idempotencyLevel = 1; - break; - case "IDEMPOTENT": - case 2: - message.idempotencyLevel = 2; - break; - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.http"] != null) { - if (typeof object[".google.api.http"] !== "object") - throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); - message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); - } - if (object[".google.api.methodSignature"]) { - if (!Array.isArray(object[".google.api.methodSignature"])) - throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); - message[".google.api.methodSignature"] = []; - for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) - message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); - } - if (object[".google.longrunning.operationInfo"] != null) { - if (typeof object[".google.longrunning.operationInfo"] !== "object") - throw TypeError(".google.protobuf.MethodOptions..google.longrunning.operationInfo: object expected"); - message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.fromObject(object[".google.longrunning.operationInfo"]); - } - return message; - }; - - /** - * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.MethodOptions} message MethodOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MethodOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.uninterpretedOption = []; - object[".google.api.methodSignature"] = []; - } - if (options.defaults) { - object.deprecated = false; - object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; - object[".google.longrunning.operationInfo"] = null; - object[".google.api.http"] = null; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) - object[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.toObject(message[".google.longrunning.operationInfo"], options); - if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { - object[".google.api.methodSignature"] = []; - for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) - object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; - } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) - object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); - return object; - }; - - /** - * Converts this MethodOptions to JSON. - * @function toJSON - * @memberof google.protobuf.MethodOptions - * @instance - * @returns {Object.} JSON object - */ - MethodOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MethodOptions - * @function getTypeUrl - * @memberof google.protobuf.MethodOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.MethodOptions"; - }; - - /** - * IdempotencyLevel enum. - * @name google.protobuf.MethodOptions.IdempotencyLevel - * @enum {number} - * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value - * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value - * @property {number} IDEMPOTENT=2 IDEMPOTENT value - */ - MethodOptions.IdempotencyLevel = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; - values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; - values[valuesById[2] = "IDEMPOTENT"] = 2; - return values; - })(); - - return MethodOptions; - })(); - - protobuf.UninterpretedOption = (function() { - - /** - * Properties of an UninterpretedOption. - * @memberof google.protobuf - * @interface IUninterpretedOption - * @property {Array.|null} [name] UninterpretedOption name - * @property {string|null} [identifierValue] UninterpretedOption identifierValue - * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue - * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue - * @property {number|null} [doubleValue] UninterpretedOption doubleValue - * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue - * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue - */ - - /** - * Constructs a new UninterpretedOption. - * @memberof google.protobuf - * @classdesc Represents an UninterpretedOption. - * @implements IUninterpretedOption - * @constructor - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set - */ - function UninterpretedOption(properties) { - this.name = []; - 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]]; - } - - /** - * UninterpretedOption name. - * @member {Array.} name - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.name = $util.emptyArray; - - /** - * UninterpretedOption identifierValue. - * @member {string} identifierValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.identifierValue = ""; - - /** - * UninterpretedOption positiveIntValue. - * @member {number|Long} positiveIntValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * UninterpretedOption negativeIntValue. - * @member {number|Long} negativeIntValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * UninterpretedOption doubleValue. - * @member {number} doubleValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.doubleValue = 0; - - /** - * UninterpretedOption stringValue. - * @member {Uint8Array} stringValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.stringValue = $util.newBuffer([]); - - /** - * UninterpretedOption aggregateValue. - * @member {string} aggregateValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.aggregateValue = ""; - - /** - * Creates a new UninterpretedOption instance using the specified properties. - * @function create - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance - */ - UninterpretedOption.create = function create(properties) { - return new UninterpretedOption(properties); - }; - - /** - * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UninterpretedOption.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && message.name.length) - for (var i = 0; i < message.name.length; ++i) - $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); - if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); - if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); - if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) - writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); - if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); - if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); - return writer; - }; - - /** - * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UninterpretedOption.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 2: { - if (!(message.name && message.name.length)) - message.name = []; - message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); - break; - } - case 3: { - message.identifierValue = reader.string(); - break; - } - case 4: { - message.positiveIntValue = reader.uint64(); - break; - } - case 5: { - message.negativeIntValue = reader.int64(); - break; - } - case 6: { - message.doubleValue = reader.double(); - break; - } - case 7: { - message.stringValue = reader.bytes(); - break; - } - case 8: { - message.aggregateValue = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UninterpretedOption message. - * @function verify - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UninterpretedOption.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) { - if (!Array.isArray(message.name)) - return "name: array expected"; - for (var i = 0; i < message.name.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); - if (error) - return "name." + error; - } - } - if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) - if (!$util.isString(message.identifierValue)) - return "identifierValue: string expected"; - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) - if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) - return "positiveIntValue: integer|Long expected"; - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) - if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) - return "negativeIntValue: integer|Long expected"; - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) - if (typeof message.doubleValue !== "number") - return "doubleValue: number expected"; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) - if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) - return "stringValue: buffer expected"; - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) - if (!$util.isString(message.aggregateValue)) - return "aggregateValue: string expected"; - return null; - }; - - /** - * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - */ - UninterpretedOption.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption) - return object; - var message = new $root.google.protobuf.UninterpretedOption(); - if (object.name) { - if (!Array.isArray(object.name)) - throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); - message.name = []; - for (var i = 0; i < object.name.length; ++i) { - if (typeof object.name[i] !== "object") - throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); - message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); - } - } - if (object.identifierValue != null) - message.identifierValue = String(object.identifierValue); - if (object.positiveIntValue != null) - if ($util.Long) - (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; - else if (typeof object.positiveIntValue === "string") - message.positiveIntValue = parseInt(object.positiveIntValue, 10); - else if (typeof object.positiveIntValue === "number") - message.positiveIntValue = object.positiveIntValue; - else if (typeof object.positiveIntValue === "object") - message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); - if (object.negativeIntValue != null) - if ($util.Long) - (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; - else if (typeof object.negativeIntValue === "string") - message.negativeIntValue = parseInt(object.negativeIntValue, 10); - else if (typeof object.negativeIntValue === "number") - message.negativeIntValue = object.negativeIntValue; - else if (typeof object.negativeIntValue === "object") - message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); - if (object.doubleValue != null) - message.doubleValue = Number(object.doubleValue); - if (object.stringValue != null) - if (typeof object.stringValue === "string") - $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); - else if (object.stringValue.length >= 0) - message.stringValue = object.stringValue; - if (object.aggregateValue != null) - message.aggregateValue = String(object.aggregateValue); - return message; - }; - - /** - * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.UninterpretedOption} message UninterpretedOption - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UninterpretedOption.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.name = []; - if (options.defaults) { - object.identifierValue = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.positiveIntValue = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.negativeIntValue = options.longs === String ? "0" : 0; - object.doubleValue = 0; - if (options.bytes === String) - object.stringValue = ""; - else { - object.stringValue = []; - if (options.bytes !== Array) - object.stringValue = $util.newBuffer(object.stringValue); - } - object.aggregateValue = ""; - } - if (message.name && message.name.length) { - object.name = []; - for (var j = 0; j < message.name.length; ++j) - object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); - } - if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) - object.identifierValue = message.identifierValue; - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) - if (typeof message.positiveIntValue === "number") - object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; - else - object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) - if (typeof message.negativeIntValue === "number") - object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; - else - object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) - object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) - object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) - object.aggregateValue = message.aggregateValue; - return object; - }; - - /** - * Converts this UninterpretedOption to JSON. - * @function toJSON - * @memberof google.protobuf.UninterpretedOption - * @instance - * @returns {Object.} JSON object - */ - UninterpretedOption.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UninterpretedOption - * @function getTypeUrl - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; - }; - - UninterpretedOption.NamePart = (function() { - - /** - * Properties of a NamePart. - * @memberof google.protobuf.UninterpretedOption - * @interface INamePart - * @property {string} namePart NamePart namePart - * @property {boolean} isExtension NamePart isExtension - */ - - /** - * Constructs a new NamePart. - * @memberof google.protobuf.UninterpretedOption - * @classdesc Represents a NamePart. - * @implements INamePart - * @constructor - * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set - */ - function NamePart(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]]; - } - - /** - * NamePart namePart. - * @member {string} namePart - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - */ - NamePart.prototype.namePart = ""; - - /** - * NamePart isExtension. - * @member {boolean} isExtension - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - */ - NamePart.prototype.isExtension = false; - - /** - * Creates a new NamePart instance using the specified properties. - * @function create - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance - */ - NamePart.create = function create(properties) { - return new NamePart(properties); - }; - - /** - * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NamePart.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); - return writer; - }; - - /** - * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NamePart.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NamePart message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NamePart.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.namePart = reader.string(); - break; - } - case 2: { - message.isExtension = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("namePart")) - throw $util.ProtocolError("missing required 'namePart'", { instance: message }); - if (!message.hasOwnProperty("isExtension")) - throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); - return message; - }; - - /** - * Decodes a NamePart message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NamePart.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NamePart message. - * @function verify - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NamePart.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.namePart)) - return "namePart: string expected"; - if (typeof message.isExtension !== "boolean") - return "isExtension: boolean expected"; - return null; - }; - - /** - * Creates a NamePart message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - */ - NamePart.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) - return object; - var message = new $root.google.protobuf.UninterpretedOption.NamePart(); - if (object.namePart != null) - message.namePart = String(object.namePart); - if (object.isExtension != null) - message.isExtension = Boolean(object.isExtension); - return message; - }; - - /** - * Creates a plain object from a NamePart message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NamePart.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.namePart = ""; - object.isExtension = false; - } - if (message.namePart != null && message.hasOwnProperty("namePart")) - object.namePart = message.namePart; - if (message.isExtension != null && message.hasOwnProperty("isExtension")) - object.isExtension = message.isExtension; - return object; - }; - - /** - * Converts this NamePart to JSON. - * @function toJSON - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - * @returns {Object.} JSON object - */ - NamePart.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NamePart - * @function getTypeUrl - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; - }; - - return NamePart; - })(); - - return UninterpretedOption; - })(); - - protobuf.SourceCodeInfo = (function() { - - /** - * Properties of a SourceCodeInfo. - * @memberof google.protobuf - * @interface ISourceCodeInfo - * @property {Array.|null} [location] SourceCodeInfo location - */ - - /** - * Constructs a new SourceCodeInfo. - * @memberof google.protobuf - * @classdesc Represents a SourceCodeInfo. - * @implements ISourceCodeInfo - * @constructor - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set - */ - function SourceCodeInfo(properties) { - this.location = []; - 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]]; - } - - /** - * SourceCodeInfo location. - * @member {Array.} location - * @memberof google.protobuf.SourceCodeInfo - * @instance - */ - SourceCodeInfo.prototype.location = $util.emptyArray; - - /** - * Creates a new SourceCodeInfo instance using the specified properties. - * @function create - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance - */ - SourceCodeInfo.create = function create(properties) { - return new SourceCodeInfo(properties); - }; - - /** - * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @function encode - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SourceCodeInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.location != null && message.location.length) - for (var i = 0; i < message.location.length; ++i) - $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SourceCodeInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.location && message.location.length)) - message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SourceCodeInfo message. - * @function verify - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SourceCodeInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.location != null && message.hasOwnProperty("location")) { - if (!Array.isArray(message.location)) - return "location: array expected"; - for (var i = 0; i < message.location.length; ++i) { - var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); - if (error) - return "location." + error; - } - } - return null; - }; - - /** - * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - */ - SourceCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.SourceCodeInfo) - return object; - var message = new $root.google.protobuf.SourceCodeInfo(); - if (object.location) { - if (!Array.isArray(object.location)) - throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); - message.location = []; - for (var i = 0; i < object.location.length; ++i) { - if (typeof object.location[i] !== "object") - throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); - message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SourceCodeInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.location = []; - if (message.location && message.location.length) { - object.location = []; - for (var j = 0; j < message.location.length; ++j) - object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); - } - return object; - }; - - /** - * Converts this SourceCodeInfo to JSON. - * @function toJSON - * @memberof google.protobuf.SourceCodeInfo - * @instance - * @returns {Object.} JSON object - */ - SourceCodeInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SourceCodeInfo - * @function getTypeUrl - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; - }; - - SourceCodeInfo.Location = (function() { - - /** - * Properties of a Location. - * @memberof google.protobuf.SourceCodeInfo - * @interface ILocation - * @property {Array.|null} [path] Location path - * @property {Array.|null} [span] Location span - * @property {string|null} [leadingComments] Location leadingComments - * @property {string|null} [trailingComments] Location trailingComments - * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments - */ - - /** - * Constructs a new Location. - * @memberof google.protobuf.SourceCodeInfo - * @classdesc Represents a Location. - * @implements ILocation - * @constructor - * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set - */ - function Location(properties) { - this.path = []; - this.span = []; - this.leadingDetachedComments = []; - 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]]; - } - - /** - * Location path. - * @member {Array.} path - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.path = $util.emptyArray; - - /** - * Location span. - * @member {Array.} span - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.span = $util.emptyArray; - - /** - * Location leadingComments. - * @member {string} leadingComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leadingComments = ""; - - /** - * Location trailingComments. - * @member {string} trailingComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.trailingComments = ""; - - /** - * Location leadingDetachedComments. - * @member {Array.} leadingDetachedComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leadingDetachedComments = $util.emptyArray; - - /** - * Creates a new Location instance using the specified properties. - * @function create - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo.Location} Location instance - */ - Location.create = function create(properties) { - return new Location(properties); - }; - - /** - * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @function encode - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - if (message.span != null && message.span.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.span.length; ++i) - writer.int32(message.span[i]); - writer.ldelim(); - } - if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); - if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); - if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) - for (var i = 0; i < message.leadingDetachedComments.length; ++i) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); - return writer; - }; - - /** - * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Location message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - } - case 2: { - if (!(message.span && message.span.length)) - message.span = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.span.push(reader.int32()); - } else - message.span.push(reader.int32()); - break; - } - case 3: { - message.leadingComments = reader.string(); - break; - } - case 4: { - message.trailingComments = reader.string(); - break; - } - case 6: { - if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) - message.leadingDetachedComments = []; - message.leadingDetachedComments.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Location message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Location message. - * @function verify - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Location.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (var i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - if (message.span != null && message.hasOwnProperty("span")) { - if (!Array.isArray(message.span)) - return "span: array expected"; - for (var i = 0; i < message.span.length; ++i) - if (!$util.isInteger(message.span[i])) - return "span: integer[] expected"; - } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) - if (!$util.isString(message.leadingComments)) - return "leadingComments: string expected"; - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) - if (!$util.isString(message.trailingComments)) - return "trailingComments: string expected"; - if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { - if (!Array.isArray(message.leadingDetachedComments)) - return "leadingDetachedComments: array expected"; - for (var i = 0; i < message.leadingDetachedComments.length; ++i) - if (!$util.isString(message.leadingDetachedComments[i])) - return "leadingDetachedComments: string[] expected"; - } - return null; - }; - - /** - * Creates a Location message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.SourceCodeInfo.Location} Location - */ - Location.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) - return object; - var message = new $root.google.protobuf.SourceCodeInfo.Location(); - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); - message.path = []; - for (var i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - if (object.span) { - if (!Array.isArray(object.span)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); - message.span = []; - for (var i = 0; i < object.span.length; ++i) - message.span[i] = object.span[i] | 0; - } - if (object.leadingComments != null) - message.leadingComments = String(object.leadingComments); - if (object.trailingComments != null) - message.trailingComments = String(object.trailingComments); - if (object.leadingDetachedComments) { - if (!Array.isArray(object.leadingDetachedComments)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); - message.leadingDetachedComments = []; - for (var i = 0; i < object.leadingDetachedComments.length; ++i) - message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); - } - return message; - }; - - /** - * Creates a plain object from a Location message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.Location} message Location - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Location.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.path = []; - object.span = []; - object.leadingDetachedComments = []; - } - if (options.defaults) { - object.leadingComments = ""; - object.trailingComments = ""; - } - if (message.path && message.path.length) { - object.path = []; - for (var j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - if (message.span && message.span.length) { - object.span = []; - for (var j = 0; j < message.span.length; ++j) - object.span[j] = message.span[j]; - } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) - object.leadingComments = message.leadingComments; - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) - object.trailingComments = message.trailingComments; - if (message.leadingDetachedComments && message.leadingDetachedComments.length) { - object.leadingDetachedComments = []; - for (var j = 0; j < message.leadingDetachedComments.length; ++j) - object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; - } - return object; - }; - - /** - * Converts this Location to JSON. - * @function toJSON - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - * @returns {Object.} JSON object - */ - Location.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Location - * @function getTypeUrl - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; - }; - - return Location; - })(); - - return SourceCodeInfo; - })(); - - protobuf.GeneratedCodeInfo = (function() { - - /** - * Properties of a GeneratedCodeInfo. - * @memberof google.protobuf - * @interface IGeneratedCodeInfo - * @property {Array.|null} [annotation] GeneratedCodeInfo annotation - */ - - /** - * Constructs a new GeneratedCodeInfo. - * @memberof google.protobuf - * @classdesc Represents a GeneratedCodeInfo. - * @implements IGeneratedCodeInfo - * @constructor - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set - */ - function GeneratedCodeInfo(properties) { - this.annotation = []; - 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]]; - } - - /** - * GeneratedCodeInfo annotation. - * @member {Array.} annotation - * @memberof google.protobuf.GeneratedCodeInfo - * @instance - */ - GeneratedCodeInfo.prototype.annotation = $util.emptyArray; - - /** - * Creates a new GeneratedCodeInfo instance using the specified properties. - * @function create - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance - */ - GeneratedCodeInfo.create = function create(properties) { - return new GeneratedCodeInfo(properties); - }; - - /** - * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @function encode - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeneratedCodeInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.annotation != null && message.annotation.length) - for (var i = 0; i < message.annotation.length; ++i) - $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeneratedCodeInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.annotation && message.annotation.length)) - message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GeneratedCodeInfo message. - * @function verify - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GeneratedCodeInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.annotation != null && message.hasOwnProperty("annotation")) { - if (!Array.isArray(message.annotation)) - return "annotation: array expected"; - for (var i = 0; i < message.annotation.length; ++i) { - var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); - if (error) - return "annotation." + error; - } - } - return null; - }; - - /** - * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - */ - GeneratedCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo) - return object; - var message = new $root.google.protobuf.GeneratedCodeInfo(); - if (object.annotation) { - if (!Array.isArray(object.annotation)) - throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); - message.annotation = []; - for (var i = 0; i < object.annotation.length; ++i) { - if (typeof object.annotation[i] !== "object") - throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); - message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GeneratedCodeInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.annotation = []; - if (message.annotation && message.annotation.length) { - object.annotation = []; - for (var j = 0; j < message.annotation.length; ++j) - object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); - } - return object; - }; - - /** - * Converts this GeneratedCodeInfo to JSON. - * @function toJSON - * @memberof google.protobuf.GeneratedCodeInfo - * @instance - * @returns {Object.} JSON object - */ - GeneratedCodeInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GeneratedCodeInfo - * @function getTypeUrl - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; - }; - - GeneratedCodeInfo.Annotation = (function() { - - /** - * Properties of an Annotation. - * @memberof google.protobuf.GeneratedCodeInfo - * @interface IAnnotation - * @property {Array.|null} [path] Annotation path - * @property {string|null} [sourceFile] Annotation sourceFile - * @property {number|null} [begin] Annotation begin - * @property {number|null} [end] Annotation end - * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic - */ - - /** - * Constructs a new Annotation. - * @memberof google.protobuf.GeneratedCodeInfo - * @classdesc Represents an Annotation. - * @implements IAnnotation - * @constructor - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set - */ - function Annotation(properties) { - this.path = []; - 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]]; - } - - /** - * Annotation path. - * @member {Array.} path - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.path = $util.emptyArray; - - /** - * Annotation sourceFile. - * @member {string} sourceFile - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.sourceFile = ""; - - /** - * Annotation begin. - * @member {number} begin - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.begin = 0; - - /** - * Annotation end. - * @member {number} end - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.end = 0; - - /** - * Annotation semantic. - * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.semantic = 0; - - /** - * Creates a new Annotation instance using the specified properties. - * @function create - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance - */ - Annotation.create = function create(properties) { - return new Annotation(properties); - }; - - /** - * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @function encode - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Annotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); - if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); - if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); - return writer; - }; - - /** - * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Annotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Annotation message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Annotation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - } - case 2: { - message.sourceFile = reader.string(); - break; - } - case 3: { - message.begin = reader.int32(); - break; - } - case 4: { - message.end = reader.int32(); - break; - } - case 5: { - message.semantic = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Annotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Annotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Annotation message. - * @function verify - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Annotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (var i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) - if (!$util.isString(message.sourceFile)) - return "sourceFile: string expected"; - if (message.begin != null && message.hasOwnProperty("begin")) - if (!$util.isInteger(message.begin)) - return "begin: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - if (message.semantic != null && message.hasOwnProperty("semantic")) - switch (message.semantic) { - default: - return "semantic: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates an Annotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - */ - Annotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) - return object; - var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); - message.path = []; - for (var i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - if (object.sourceFile != null) - message.sourceFile = String(object.sourceFile); - if (object.begin != null) - message.begin = object.begin | 0; - if (object.end != null) - message.end = object.end | 0; - switch (object.semantic) { - default: - if (typeof object.semantic === "number") { - message.semantic = object.semantic; - break; - } - break; - case "NONE": - case 0: - message.semantic = 0; - break; - case "SET": - case 1: - message.semantic = 1; - break; - case "ALIAS": - case 2: - message.semantic = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from an Annotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Annotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.path = []; - if (options.defaults) { - object.sourceFile = ""; - object.begin = 0; - object.end = 0; - object.semantic = options.enums === String ? "NONE" : 0; - } - if (message.path && message.path.length) { - object.path = []; - for (var j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) - object.sourceFile = message.sourceFile; - if (message.begin != null && message.hasOwnProperty("begin")) - object.begin = message.begin; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - if (message.semantic != null && message.hasOwnProperty("semantic")) - object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; - return object; - }; - - /** - * Converts this Annotation to JSON. - * @function toJSON - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - * @returns {Object.} JSON object - */ - Annotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Annotation - * @function getTypeUrl - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; - }; - - /** - * Semantic enum. - * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic - * @enum {number} - * @property {number} NONE=0 NONE value - * @property {number} SET=1 SET value - * @property {number} ALIAS=2 ALIAS value - */ - Annotation.Semantic = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NONE"] = 0; - values[valuesById[1] = "SET"] = 1; - values[valuesById[2] = "ALIAS"] = 2; - return values; - })(); - - return Annotation; - })(); - - return GeneratedCodeInfo; - })(); - - protobuf.Any = (function() { - - /** - * Properties of an Any. - * @memberof google.protobuf - * @interface IAny - * @property {string|null} [type_url] Any type_url - * @property {Uint8Array|null} [value] Any value - */ - - /** - * Constructs a new Any. - * @memberof google.protobuf - * @classdesc Represents an Any. - * @implements IAny - * @constructor - * @param {google.protobuf.IAny=} [properties] Properties to set - */ - function Any(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]]; - } - - /** - * Any type_url. - * @member {string} type_url - * @memberof google.protobuf.Any - * @instance - */ - Any.prototype.type_url = ""; - - /** - * Any value. - * @member {Uint8Array} value - * @memberof google.protobuf.Any - * @instance - */ - Any.prototype.value = $util.newBuffer([]); - - /** - * Creates a new Any instance using the specified properties. - * @function create - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.IAny=} [properties] Properties to set - * @returns {google.protobuf.Any} Any instance - */ - Any.create = function create(properties) { - return new Any(properties); - }; - - /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Any.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - return writer; - }; - - /** - * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Any.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Any message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Any - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Any} Any - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Any.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.type_url = reader.string(); - break; - } - case 2: { - message.value = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Any message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Any - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Any} Any - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Any.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Any message. - * @function verify - * @memberof google.protobuf.Any - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Any.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type_url != null && message.hasOwnProperty("type_url")) - if (!$util.isString(message.type_url)) - return "type_url: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates an Any message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Any - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Any} Any - */ - Any.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Any) - return object; - var message = new $root.google.protobuf.Any(); - if (object.type_url != null) - message.type_url = String(object.type_url); - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length >= 0) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from an Any message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.Any} message Any - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Any.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type_url = ""; - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - } - if (message.type_url != null && message.hasOwnProperty("type_url")) - object.type_url = message.type_url; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; - - /** - * Converts this Any to JSON. - * @function toJSON - * @memberof google.protobuf.Any - * @instance - * @returns {Object.} JSON object - */ - Any.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Any - * @function getTypeUrl - * @memberof google.protobuf.Any - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Any"; - }; - - return Any; - })(); - - protobuf.Duration = (function() { - - /** - * Properties of a Duration. - * @memberof google.protobuf - * @interface IDuration - * @property {number|Long|null} [seconds] Duration seconds - * @property {number|null} [nanos] Duration nanos - */ - - /** - * Constructs a new Duration. - * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration - * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set - */ - function Duration(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]]; - } - - /** - * Duration seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Duration - * @instance - */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Duration nanos. - * @member {number} nanos - * @memberof google.protobuf.Duration - * @instance - */ - Duration.prototype.nanos = 0; - - /** - * Creates a new Duration instance using the specified properties. - * @function create - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.IDuration=} [properties] Properties to set - * @returns {google.protobuf.Duration} Duration instance - */ - Duration.create = function create(properties) { - return new Duration(properties); - }; - - /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Duration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); - return writer; - }; - - /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Duration message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Duration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Duration} Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Duration.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.seconds = reader.int64(); - break; - } - case 2: { - message.nanos = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Duration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Duration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Duration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Duration message. - * @function verify - * @memberof google.protobuf.Duration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Duration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; - return null; - }; - - /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Duration - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration - */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) - return object; - var message = new $root.google.protobuf.Duration(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; - return message; - }; - - /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.Duration} message Duration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Duration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; - } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; - return object; - }; - - /** - * Converts this Duration to JSON. - * @function toJSON - * @memberof google.protobuf.Duration - * @instance - * @returns {Object.} JSON object - */ - Duration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Duration - * @function getTypeUrl - * @memberof google.protobuf.Duration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Duration"; - }; - - return Duration; - })(); - - protobuf.Empty = (function() { - - /** - * Properties of an Empty. - * @memberof google.protobuf - * @interface IEmpty - */ - - /** - * Constructs a new Empty. - * @memberof google.protobuf - * @classdesc Represents an Empty. - * @implements IEmpty - * @constructor - * @param {google.protobuf.IEmpty=} [properties] Properties to set - */ - function Empty(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 Empty instance using the specified properties. - * @function create - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty=} [properties] Properties to set - * @returns {google.protobuf.Empty} Empty instance - */ - Empty.create = function create(properties) { - return new Empty(properties); - }; - - /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Empty.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Empty.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Empty message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Empty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Empty} Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Empty.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Empty message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Empty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Empty} Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Empty.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Empty message. - * @function verify - * @memberof google.protobuf.Empty - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Empty.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Empty - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Empty} Empty - */ - Empty.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Empty) - return object; - return new $root.google.protobuf.Empty(); - }; - - /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.Empty} message Empty - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Empty.toObject = function toObject() { - return {}; - }; - - /** - * Converts this Empty to JSON. - * @function toJSON - * @memberof google.protobuf.Empty - * @instance - * @returns {Object.} JSON object - */ - Empty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Empty - * @function getTypeUrl - * @memberof google.protobuf.Empty - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Empty"; - }; - - return Empty; - })(); - - protobuf.FieldMask = (function() { - - /** - * Properties of a FieldMask. - * @memberof google.protobuf - * @interface IFieldMask - * @property {Array.|null} [paths] FieldMask paths - */ - - /** - * Constructs a new FieldMask. - * @memberof google.protobuf - * @classdesc Represents a FieldMask. - * @implements IFieldMask - * @constructor - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - */ - function FieldMask(properties) { - this.paths = []; - 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]]; - } - - /** - * FieldMask paths. - * @member {Array.} paths - * @memberof google.protobuf.FieldMask - * @instance - */ - FieldMask.prototype.paths = $util.emptyArray; - - /** - * Creates a new FieldMask instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - * @returns {google.protobuf.FieldMask} FieldMask instance - */ - FieldMask.create = function create(properties) { - return new FieldMask(properties); - }; - - /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldMask.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.paths != null && message.paths.length) - for (var i = 0; i < message.paths.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); - return writer; - }; - - /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldMask.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldMask message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldMask - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldMask} FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldMask.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldMask - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldMask} FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldMask.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldMask message. - * @function verify - * @memberof google.protobuf.FieldMask - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldMask.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.paths != null && message.hasOwnProperty("paths")) { - if (!Array.isArray(message.paths)) - return "paths: array expected"; - for (var i = 0; i < message.paths.length; ++i) - if (!$util.isString(message.paths[i])) - return "paths: string[] expected"; - } - return null; - }; - - /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldMask - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldMask} FieldMask - */ - FieldMask.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldMask) - return object; - var message = new $root.google.protobuf.FieldMask(); - if (object.paths) { - if (!Array.isArray(object.paths)) - throw TypeError(".google.protobuf.FieldMask.paths: array expected"); - message.paths = []; - for (var i = 0; i < object.paths.length; ++i) - message.paths[i] = String(object.paths[i]); - } - return message; - }; - - /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.FieldMask} message FieldMask - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldMask.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.paths = []; - if (message.paths && message.paths.length) { - object.paths = []; - for (var j = 0; j < message.paths.length; ++j) - object.paths[j] = message.paths[j]; - } - return object; - }; - - /** - * Converts this FieldMask to JSON. - * @function toJSON - * @memberof google.protobuf.FieldMask - * @instance - * @returns {Object.} JSON object - */ - FieldMask.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FieldMask - * @function getTypeUrl - * @memberof google.protobuf.FieldMask - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldMask"; - }; - - return FieldMask; - })(); - - protobuf.Timestamp = (function() { - - /** - * Properties of a Timestamp. - * @memberof google.protobuf - * @interface ITimestamp - * @property {number|Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos - */ - - /** - * Constructs a new Timestamp. - * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp - * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - */ - function Timestamp(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]]; - } - - /** - * Timestamp seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Timestamp - * @instance - */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Timestamp nanos. - * @member {number} nanos - * @memberof google.protobuf.Timestamp - * @instance - */ - Timestamp.prototype.nanos = 0; - - /** - * Creates a new Timestamp instance using the specified properties. - * @function create - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - * @returns {google.protobuf.Timestamp} Timestamp instance - */ - Timestamp.create = function create(properties) { - return new Timestamp(properties); - }; - - /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Timestamp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); - return writer; - }; - - /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Timestamp message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Timestamp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Timestamp} Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Timestamp.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.seconds = reader.int64(); - break; - } - case 2: { - message.nanos = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Timestamp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Timestamp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Timestamp message. - * @function verify - * @memberof google.protobuf.Timestamp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Timestamp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; - return null; - }; - - /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Timestamp - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp - */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) - return object; - var message = new $root.google.protobuf.Timestamp(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; - return message; - }; - - /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.Timestamp} message Timestamp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Timestamp.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; - } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; - return object; - }; - - /** - * Converts this Timestamp to JSON. - * @function toJSON - * @memberof google.protobuf.Timestamp - * @instance - * @returns {Object.} JSON object - */ - Timestamp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Timestamp - * @function getTypeUrl - * @memberof google.protobuf.Timestamp - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Timestamp"; - }; - - return Timestamp; - })(); - - protobuf.DoubleValue = (function() { - - /** - * Properties of a DoubleValue. - * @memberof google.protobuf - * @interface IDoubleValue - * @property {number|null} [value] DoubleValue value - */ - - /** - * Constructs a new DoubleValue. - * @memberof google.protobuf - * @classdesc Represents a DoubleValue. - * @implements IDoubleValue - * @constructor - * @param {google.protobuf.IDoubleValue=} [properties] Properties to set - */ - function DoubleValue(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]]; - } - - /** - * DoubleValue value. - * @member {number} value - * @memberof google.protobuf.DoubleValue - * @instance - */ - DoubleValue.prototype.value = 0; - - /** - * Creates a new DoubleValue instance using the specified properties. - * @function create - * @memberof google.protobuf.DoubleValue - * @static - * @param {google.protobuf.IDoubleValue=} [properties] Properties to set - * @returns {google.protobuf.DoubleValue} DoubleValue instance - */ - DoubleValue.create = function create(properties) { - return new DoubleValue(properties); - }; - - /** - * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DoubleValue - * @static - * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DoubleValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); - return writer; - }; - - /** - * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DoubleValue - * @static - * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DoubleValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DoubleValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DoubleValue} DoubleValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DoubleValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DoubleValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.double(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DoubleValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DoubleValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DoubleValue} DoubleValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DoubleValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DoubleValue message. - * @function verify - * @memberof google.protobuf.DoubleValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DoubleValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value !== "number") - return "value: number expected"; - return null; - }; - - /** - * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DoubleValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DoubleValue} DoubleValue - */ - DoubleValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DoubleValue) - return object; - var message = new $root.google.protobuf.DoubleValue(); - if (object.value != null) - message.value = Number(object.value); - return message; - }; - - /** - * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DoubleValue - * @static - * @param {google.protobuf.DoubleValue} message DoubleValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DoubleValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = 0; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; - return object; - }; - - /** - * Converts this DoubleValue to JSON. - * @function toJSON - * @memberof google.protobuf.DoubleValue - * @instance - * @returns {Object.} JSON object - */ - DoubleValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DoubleValue - * @function getTypeUrl - * @memberof google.protobuf.DoubleValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DoubleValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DoubleValue"; - }; - - return DoubleValue; - })(); - - protobuf.FloatValue = (function() { - - /** - * Properties of a FloatValue. - * @memberof google.protobuf - * @interface IFloatValue - * @property {number|null} [value] FloatValue value - */ - - /** - * Constructs a new FloatValue. - * @memberof google.protobuf - * @classdesc Represents a FloatValue. - * @implements IFloatValue - * @constructor - * @param {google.protobuf.IFloatValue=} [properties] Properties to set - */ - function FloatValue(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]]; - } - - /** - * FloatValue value. - * @member {number} value - * @memberof google.protobuf.FloatValue - * @instance - */ - FloatValue.prototype.value = 0; - - /** - * Creates a new FloatValue instance using the specified properties. - * @function create - * @memberof google.protobuf.FloatValue - * @static - * @param {google.protobuf.IFloatValue=} [properties] Properties to set - * @returns {google.protobuf.FloatValue} FloatValue instance - */ - FloatValue.create = function create(properties) { - return new FloatValue(properties); - }; - - /** - * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FloatValue - * @static - * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FloatValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); - return writer; - }; - - /** - * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FloatValue - * @static - * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FloatValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FloatValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FloatValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FloatValue} FloatValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FloatValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FloatValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FloatValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FloatValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FloatValue} FloatValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FloatValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FloatValue message. - * @function verify - * @memberof google.protobuf.FloatValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FloatValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value !== "number") - return "value: number expected"; - return null; - }; - - /** - * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FloatValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FloatValue} FloatValue - */ - FloatValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FloatValue) - return object; - var message = new $root.google.protobuf.FloatValue(); - if (object.value != null) - message.value = Number(object.value); - return message; - }; - - /** - * Creates a plain object from a FloatValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FloatValue - * @static - * @param {google.protobuf.FloatValue} message FloatValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FloatValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = 0; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; - return object; - }; - - /** - * Converts this FloatValue to JSON. - * @function toJSON - * @memberof google.protobuf.FloatValue - * @instance - * @returns {Object.} JSON object - */ - FloatValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FloatValue - * @function getTypeUrl - * @memberof google.protobuf.FloatValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FloatValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FloatValue"; - }; - - return FloatValue; - })(); - - protobuf.Int64Value = (function() { - - /** - * Properties of an Int64Value. - * @memberof google.protobuf - * @interface IInt64Value - * @property {number|Long|null} [value] Int64Value value - */ - - /** - * Constructs a new Int64Value. - * @memberof google.protobuf - * @classdesc Represents an Int64Value. - * @implements IInt64Value - * @constructor - * @param {google.protobuf.IInt64Value=} [properties] Properties to set - */ - function Int64Value(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]]; - } - - /** - * Int64Value value. - * @member {number|Long} value - * @memberof google.protobuf.Int64Value - * @instance - */ - Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new Int64Value instance using the specified properties. - * @function create - * @memberof google.protobuf.Int64Value - * @static - * @param {google.protobuf.IInt64Value=} [properties] Properties to set - * @returns {google.protobuf.Int64Value} Int64Value instance - */ - Int64Value.create = function create(properties) { - return new Int64Value(properties); - }; - - /** - * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Int64Value - * @static - * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Int64Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); - return writer; - }; - - /** - * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Int64Value - * @static - * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Int64Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Int64Value message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Int64Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Int64Value} Int64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Int64Value.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int64Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Int64Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Int64Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Int64Value} Int64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Int64Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Int64Value message. - * @function verify - * @memberof google.protobuf.Int64Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Int64Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) - return "value: integer|Long expected"; - return null; - }; - - /** - * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Int64Value - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Int64Value} Int64Value - */ - Int64Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Int64Value) - return object; - var message = new $root.google.protobuf.Int64Value(); - if (object.value != null) - if ($util.Long) - (message.value = $util.Long.fromValue(object.value)).unsigned = false; - else if (typeof object.value === "string") - message.value = parseInt(object.value, 10); - else if (typeof object.value === "number") - message.value = object.value; - else if (typeof object.value === "object") - message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from an Int64Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Int64Value - * @static - * @param {google.protobuf.Int64Value} message Int64Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Int64Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.value = options.longs === String ? "0" : 0; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value === "number") - object.value = options.longs === String ? String(message.value) : message.value; - else - object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; - return object; - }; - - /** - * Converts this Int64Value to JSON. - * @function toJSON - * @memberof google.protobuf.Int64Value - * @instance - * @returns {Object.} JSON object - */ - Int64Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Int64Value - * @function getTypeUrl - * @memberof google.protobuf.Int64Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Int64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Int64Value"; - }; - - return Int64Value; - })(); - - protobuf.UInt64Value = (function() { - - /** - * Properties of a UInt64Value. - * @memberof google.protobuf - * @interface IUInt64Value - * @property {number|Long|null} [value] UInt64Value value - */ - - /** - * Constructs a new UInt64Value. - * @memberof google.protobuf - * @classdesc Represents a UInt64Value. - * @implements IUInt64Value - * @constructor - * @param {google.protobuf.IUInt64Value=} [properties] Properties to set - */ - function UInt64Value(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]]; - } - - /** - * UInt64Value value. - * @member {number|Long} value - * @memberof google.protobuf.UInt64Value - * @instance - */ - UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Creates a new UInt64Value instance using the specified properties. - * @function create - * @memberof google.protobuf.UInt64Value - * @static - * @param {google.protobuf.IUInt64Value=} [properties] Properties to set - * @returns {google.protobuf.UInt64Value} UInt64Value instance - */ - UInt64Value.create = function create(properties) { - return new UInt64Value(properties); - }; - - /** - * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UInt64Value - * @static - * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UInt64Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); - return writer; - }; - - /** - * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UInt64Value - * @static - * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UInt64Value message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UInt64Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UInt64Value} UInt64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UInt64Value.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt64Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.uint64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UInt64Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UInt64Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UInt64Value} UInt64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UInt64Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UInt64Value message. - * @function verify - * @memberof google.protobuf.UInt64Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UInt64Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) - return "value: integer|Long expected"; - return null; - }; - - /** - * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UInt64Value - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UInt64Value} UInt64Value - */ - UInt64Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UInt64Value) - return object; - var message = new $root.google.protobuf.UInt64Value(); - if (object.value != null) - if ($util.Long) - (message.value = $util.Long.fromValue(object.value)).unsigned = true; - else if (typeof object.value === "string") - message.value = parseInt(object.value, 10); - else if (typeof object.value === "number") - message.value = object.value; - else if (typeof object.value === "object") - message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UInt64Value - * @static - * @param {google.protobuf.UInt64Value} message UInt64Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UInt64Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.value = options.longs === String ? "0" : 0; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value === "number") - object.value = options.longs === String ? String(message.value) : message.value; - else - object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber(true) : message.value; - return object; - }; - - /** - * Converts this UInt64Value to JSON. - * @function toJSON - * @memberof google.protobuf.UInt64Value - * @instance - * @returns {Object.} JSON object - */ - UInt64Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UInt64Value - * @function getTypeUrl - * @memberof google.protobuf.UInt64Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UInt64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UInt64Value"; - }; - - return UInt64Value; - })(); - - protobuf.Int32Value = (function() { - - /** - * Properties of an Int32Value. - * @memberof google.protobuf - * @interface IInt32Value - * @property {number|null} [value] Int32Value value - */ - - /** - * Constructs a new Int32Value. - * @memberof google.protobuf - * @classdesc Represents an Int32Value. - * @implements IInt32Value - * @constructor - * @param {google.protobuf.IInt32Value=} [properties] Properties to set - */ - function Int32Value(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]]; - } - - /** - * Int32Value value. - * @member {number} value - * @memberof google.protobuf.Int32Value - * @instance - */ - Int32Value.prototype.value = 0; - - /** - * Creates a new Int32Value instance using the specified properties. - * @function create - * @memberof google.protobuf.Int32Value - * @static - * @param {google.protobuf.IInt32Value=} [properties] Properties to set - * @returns {google.protobuf.Int32Value} Int32Value instance - */ - Int32Value.create = function create(properties) { - return new Int32Value(properties); - }; - - /** - * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Int32Value - * @static - * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Int32Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); - return writer; - }; - - /** - * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Int32Value - * @static - * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Int32Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Int32Value message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Int32Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Int32Value} Int32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Int32Value.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int32Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Int32Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Int32Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Int32Value} Int32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Int32Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Int32Value message. - * @function verify - * @memberof google.protobuf.Int32Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Int32Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isInteger(message.value)) - return "value: integer expected"; - return null; - }; - - /** - * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Int32Value - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Int32Value} Int32Value - */ - Int32Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Int32Value) - return object; - var message = new $root.google.protobuf.Int32Value(); - if (object.value != null) - message.value = object.value | 0; - return message; - }; - - /** - * Creates a plain object from an Int32Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Int32Value - * @static - * @param {google.protobuf.Int32Value} message Int32Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Int32Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = 0; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this Int32Value to JSON. - * @function toJSON - * @memberof google.protobuf.Int32Value - * @instance - * @returns {Object.} JSON object - */ - Int32Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Int32Value - * @function getTypeUrl - * @memberof google.protobuf.Int32Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Int32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Int32Value"; - }; - - return Int32Value; - })(); - - protobuf.UInt32Value = (function() { - - /** - * Properties of a UInt32Value. - * @memberof google.protobuf - * @interface IUInt32Value - * @property {number|null} [value] UInt32Value value - */ - - /** - * Constructs a new UInt32Value. - * @memberof google.protobuf - * @classdesc Represents a UInt32Value. - * @implements IUInt32Value - * @constructor - * @param {google.protobuf.IUInt32Value=} [properties] Properties to set - */ - function UInt32Value(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]]; - } - - /** - * UInt32Value value. - * @member {number} value - * @memberof google.protobuf.UInt32Value - * @instance - */ - UInt32Value.prototype.value = 0; - - /** - * Creates a new UInt32Value instance using the specified properties. - * @function create - * @memberof google.protobuf.UInt32Value - * @static - * @param {google.protobuf.IUInt32Value=} [properties] Properties to set - * @returns {google.protobuf.UInt32Value} UInt32Value instance - */ - UInt32Value.create = function create(properties) { - return new UInt32Value(properties); - }; - - /** - * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UInt32Value - * @static - * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UInt32Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); - return writer; - }; - - /** - * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UInt32Value - * @static - * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UInt32Value message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UInt32Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UInt32Value} UInt32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UInt32Value.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt32Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.uint32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UInt32Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UInt32Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UInt32Value} UInt32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UInt32Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UInt32Value message. - * @function verify - * @memberof google.protobuf.UInt32Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UInt32Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isInteger(message.value)) - return "value: integer expected"; - return null; - }; - - /** - * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UInt32Value - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UInt32Value} UInt32Value - */ - UInt32Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UInt32Value) - return object; - var message = new $root.google.protobuf.UInt32Value(); - if (object.value != null) - message.value = object.value >>> 0; - return message; - }; - - /** - * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UInt32Value - * @static - * @param {google.protobuf.UInt32Value} message UInt32Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UInt32Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = 0; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this UInt32Value to JSON. - * @function toJSON - * @memberof google.protobuf.UInt32Value - * @instance - * @returns {Object.} JSON object - */ - UInt32Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UInt32Value - * @function getTypeUrl - * @memberof google.protobuf.UInt32Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UInt32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UInt32Value"; - }; - - return UInt32Value; - })(); - - protobuf.BoolValue = (function() { - - /** - * Properties of a BoolValue. - * @memberof google.protobuf - * @interface IBoolValue - * @property {boolean|null} [value] BoolValue value - */ - - /** - * Constructs a new BoolValue. - * @memberof google.protobuf - * @classdesc Represents a BoolValue. - * @implements IBoolValue - * @constructor - * @param {google.protobuf.IBoolValue=} [properties] Properties to set - */ - function BoolValue(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]]; - } - - /** - * BoolValue value. - * @member {boolean} value - * @memberof google.protobuf.BoolValue - * @instance - */ - BoolValue.prototype.value = false; - - /** - * Creates a new BoolValue instance using the specified properties. - * @function create - * @memberof google.protobuf.BoolValue - * @static - * @param {google.protobuf.IBoolValue=} [properties] Properties to set - * @returns {google.protobuf.BoolValue} BoolValue instance - */ - BoolValue.create = function create(properties) { - return new BoolValue(properties); - }; - - /** - * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.BoolValue - * @static - * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoolValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); - return writer; - }; - - /** - * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.BoolValue - * @static - * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoolValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BoolValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.BoolValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.BoolValue} BoolValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoolValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BoolValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BoolValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.BoolValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.BoolValue} BoolValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoolValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BoolValue message. - * @function verify - * @memberof google.protobuf.BoolValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BoolValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value !== "boolean") - return "value: boolean expected"; - return null; - }; - - /** - * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.BoolValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.BoolValue} BoolValue - */ - BoolValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.BoolValue) - return object; - var message = new $root.google.protobuf.BoolValue(); - if (object.value != null) - message.value = Boolean(object.value); - return message; - }; - - /** - * Creates a plain object from a BoolValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.BoolValue - * @static - * @param {google.protobuf.BoolValue} message BoolValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoolValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = false; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this BoolValue to JSON. - * @function toJSON - * @memberof google.protobuf.BoolValue - * @instance - * @returns {Object.} JSON object - */ - BoolValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BoolValue - * @function getTypeUrl - * @memberof google.protobuf.BoolValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BoolValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.BoolValue"; - }; - - return BoolValue; - })(); - - protobuf.StringValue = (function() { - - /** - * Properties of a StringValue. - * @memberof google.protobuf - * @interface IStringValue - * @property {string|null} [value] StringValue value - */ - - /** - * Constructs a new StringValue. - * @memberof google.protobuf - * @classdesc Represents a StringValue. - * @implements IStringValue - * @constructor - * @param {google.protobuf.IStringValue=} [properties] Properties to set - */ - function StringValue(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]]; - } - - /** - * StringValue value. - * @member {string} value - * @memberof google.protobuf.StringValue - * @instance - */ - StringValue.prototype.value = ""; - - /** - * Creates a new StringValue instance using the specified properties. - * @function create - * @memberof google.protobuf.StringValue - * @static - * @param {google.protobuf.IStringValue=} [properties] Properties to set - * @returns {google.protobuf.StringValue} StringValue instance - */ - StringValue.create = function create(properties) { - return new StringValue(properties); - }; - - /** - * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.StringValue - * @static - * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StringValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - return writer; - }; - - /** - * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.StringValue - * @static - * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StringValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a StringValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.StringValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.StringValue} StringValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StringValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.StringValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a StringValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.StringValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.StringValue} StringValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StringValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a StringValue message. - * @function verify - * @memberof google.protobuf.StringValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - StringValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a StringValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.StringValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.StringValue} StringValue - */ - StringValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.StringValue) - return object; - var message = new $root.google.protobuf.StringValue(); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a StringValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.StringValue - * @static - * @param {google.protobuf.StringValue} message StringValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - StringValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = ""; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this StringValue to JSON. - * @function toJSON - * @memberof google.protobuf.StringValue - * @instance - * @returns {Object.} JSON object - */ - StringValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for StringValue - * @function getTypeUrl - * @memberof google.protobuf.StringValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - StringValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.StringValue"; - }; - - return StringValue; - })(); - - protobuf.BytesValue = (function() { - - /** - * Properties of a BytesValue. - * @memberof google.protobuf - * @interface IBytesValue - * @property {Uint8Array|null} [value] BytesValue value - */ - - /** - * Constructs a new BytesValue. - * @memberof google.protobuf - * @classdesc Represents a BytesValue. - * @implements IBytesValue - * @constructor - * @param {google.protobuf.IBytesValue=} [properties] Properties to set - */ - function BytesValue(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]]; - } - - /** - * BytesValue value. - * @member {Uint8Array} value - * @memberof google.protobuf.BytesValue - * @instance - */ - BytesValue.prototype.value = $util.newBuffer([]); - - /** - * Creates a new BytesValue instance using the specified properties. - * @function create - * @memberof google.protobuf.BytesValue - * @static - * @param {google.protobuf.IBytesValue=} [properties] Properties to set - * @returns {google.protobuf.BytesValue} BytesValue instance - */ - BytesValue.create = function create(properties) { - return new BytesValue(properties); - }; - - /** - * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.BytesValue - * @static - * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BytesValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); - return writer; - }; - - /** - * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.BytesValue - * @static - * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BytesValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BytesValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.BytesValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.BytesValue} BytesValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BytesValue.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BytesValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.value = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BytesValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.BytesValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.BytesValue} BytesValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BytesValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BytesValue message. - * @function verify - * @memberof google.protobuf.BytesValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BytesValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.BytesValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.BytesValue} BytesValue - */ - BytesValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.BytesValue) - return object; - var message = new $root.google.protobuf.BytesValue(); - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length >= 0) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from a BytesValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.BytesValue - * @static - * @param {google.protobuf.BytesValue} message BytesValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BytesValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; - - /** - * Converts this BytesValue to JSON. - * @function toJSON - * @memberof google.protobuf.BytesValue - * @instance - * @returns {Object.} JSON object - */ - BytesValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BytesValue - * @function getTypeUrl - * @memberof google.protobuf.BytesValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BytesValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.BytesValue"; - }; - - return BytesValue; - })(); - - return protobuf; - })(); - - google.longrunning = (function() { - - /** - * Namespace longrunning. - * @memberof google - * @namespace - */ - var longrunning = {}; - - longrunning.Operations = (function() { - - /** - * Constructs a new Operations service. - * @memberof google.longrunning - * @classdesc Represents an Operations - * @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 Operations(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; - - /** - * Creates new Operations service using the specified rpc implementation. - * @function create - * @memberof google.longrunning.Operations - * @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 {Operations} RPC service. Useful where requests and/or responses are streamed. - */ - Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.longrunning.Operations|listOperations}. - * @memberof google.longrunning.Operations - * @typedef ListOperationsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse - */ - - /** - * Calls ListOperations. - * @function listOperations - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object - * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { - return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); - }, "name", { value: "ListOperations" }); - - /** - * Calls ListOperations. - * @function listOperations - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.longrunning.Operations|getOperation}. - * @memberof google.longrunning.Operations - * @typedef GetOperationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls GetOperation. - * @function getOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object - * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { - return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "GetOperation" }); - - /** - * Calls GetOperation. - * @function getOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.longrunning.Operations|deleteOperation}. - * @memberof google.longrunning.Operations - * @typedef DeleteOperationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls DeleteOperation. - * @function deleteOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object - * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { - return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteOperation" }); - - /** - * Calls DeleteOperation. - * @function deleteOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.longrunning.Operations|cancelOperation}. - * @memberof google.longrunning.Operations - * @typedef CancelOperationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls CancelOperation. - * @function cancelOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object - * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { - return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "CancelOperation" }); - - /** - * Calls CancelOperation. - * @function cancelOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.longrunning.Operations|waitOperation}. - * @memberof google.longrunning.Operations - * @typedef WaitOperationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls WaitOperation. - * @function waitOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object - * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { - return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "WaitOperation" }); - - /** - * Calls WaitOperation. - * @function waitOperation - * @memberof google.longrunning.Operations - * @instance - * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Operations; - })(); - - longrunning.Operation = (function() { - - /** - * Properties of an Operation. - * @memberof google.longrunning - * @interface IOperation - * @property {string|null} [name] Operation name - * @property {google.protobuf.IAny|null} [metadata] Operation metadata - * @property {boolean|null} [done] Operation done - * @property {google.rpc.IStatus|null} [error] Operation error - * @property {google.protobuf.IAny|null} [response] Operation response - */ - - /** - * Constructs a new Operation. - * @memberof google.longrunning - * @classdesc Represents an Operation. - * @implements IOperation - * @constructor - * @param {google.longrunning.IOperation=} [properties] Properties to set - */ - function Operation(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]]; - } - - /** - * Operation name. - * @member {string} name - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.name = ""; - - /** - * Operation metadata. - * @member {google.protobuf.IAny|null|undefined} metadata - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.metadata = null; - - /** - * Operation done. - * @member {boolean} done - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.done = false; - - /** - * Operation error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.error = null; - - /** - * Operation response. - * @member {google.protobuf.IAny|null|undefined} response - * @memberof google.longrunning.Operation - * @instance - */ - Operation.prototype.response = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Operation result. - * @member {"error"|"response"|undefined} result - * @memberof google.longrunning.Operation - * @instance - */ - Object.defineProperty(Operation.prototype, "result", { - get: $util.oneOfGetter($oneOfFields = ["error", "response"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Operation instance using the specified properties. - * @function create - * @memberof google.longrunning.Operation - * @static - * @param {google.longrunning.IOperation=} [properties] Properties to set - * @returns {google.longrunning.Operation} Operation instance - */ - Operation.create = function create(properties) { - return new Operation(properties); - }; - - /** - * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. - * @function encode - * @memberof google.longrunning.Operation - * @static - * @param {google.longrunning.IOperation} message Operation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Operation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.done != null && Object.hasOwnProperty.call(message, "done")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.response != null && Object.hasOwnProperty.call(message, "response")) - $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.longrunning.Operation - * @static - * @param {google.longrunning.IOperation} message Operation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Operation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Operation message from the specified reader or buffer. - * @function decode - * @memberof google.longrunning.Operation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.Operation} Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Operation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.Operation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - } - case 3: { - message.done = reader.bool(); - break; - } - case 4: { - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - case 5: { - message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Operation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.longrunning.Operation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.Operation} Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Operation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Operation message. - * @function verify - * @memberof google.longrunning.Operation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Operation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.google.protobuf.Any.verify(message.metadata); - if (error) - return "metadata." + error; - } - if (message.done != null && message.hasOwnProperty("done")) - if (typeof message.done !== "boolean") - return "done: boolean expected"; - if (message.error != null && message.hasOwnProperty("error")) { - properties.result = 1; - { - var error = $root.google.rpc.Status.verify(message.error); - if (error) - return "error." + error; - } - } - if (message.response != null && message.hasOwnProperty("response")) { - if (properties.result === 1) - return "result: multiple values"; - properties.result = 1; - { - var error = $root.google.protobuf.Any.verify(message.response); - if (error) - return "response." + error; - } - } - return null; - }; - - /** - * Creates an Operation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.longrunning.Operation - * @static - * @param {Object.} object Plain object - * @returns {google.longrunning.Operation} Operation - */ - Operation.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.Operation) - return object; - var message = new $root.google.longrunning.Operation(); - if (object.name != null) - message.name = String(object.name); - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".google.longrunning.Operation.metadata: object expected"); - message.metadata = $root.google.protobuf.Any.fromObject(object.metadata); - } - if (object.done != null) - message.done = Boolean(object.done); - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.longrunning.Operation.error: object expected"); - message.error = $root.google.rpc.Status.fromObject(object.error); - } - if (object.response != null) { - if (typeof object.response !== "object") - throw TypeError(".google.longrunning.Operation.response: object expected"); - message.response = $root.google.protobuf.Any.fromObject(object.response); - } - return message; - }; - - /** - * Creates a plain object from an Operation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.longrunning.Operation - * @static - * @param {google.longrunning.Operation} message Operation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Operation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.metadata = null; - object.done = false; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options); - if (message.done != null && message.hasOwnProperty("done")) - object.done = message.done; - if (message.error != null && message.hasOwnProperty("error")) { - object.error = $root.google.rpc.Status.toObject(message.error, options); - if (options.oneofs) - object.result = "error"; - } - if (message.response != null && message.hasOwnProperty("response")) { - object.response = $root.google.protobuf.Any.toObject(message.response, options); - if (options.oneofs) - object.result = "response"; - } - return object; - }; - - /** - * Converts this Operation to JSON. - * @function toJSON - * @memberof google.longrunning.Operation - * @instance - * @returns {Object.} JSON object - */ - Operation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Operation - * @function getTypeUrl - * @memberof google.longrunning.Operation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.longrunning.Operation"; - }; - - return Operation; - })(); - - longrunning.GetOperationRequest = (function() { - - /** - * Properties of a GetOperationRequest. - * @memberof google.longrunning - * @interface IGetOperationRequest - * @property {string|null} [name] GetOperationRequest name - */ - - /** - * Constructs a new GetOperationRequest. - * @memberof google.longrunning - * @classdesc Represents a GetOperationRequest. - * @implements IGetOperationRequest - * @constructor - * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set - */ - function GetOperationRequest(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]]; - } - - /** - * GetOperationRequest name. - * @member {string} name - * @memberof google.longrunning.GetOperationRequest - * @instance - */ - GetOperationRequest.prototype.name = ""; - - /** - * Creates a new GetOperationRequest instance using the specified properties. - * @function create - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set - * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance - */ - GetOperationRequest.create = function create(properties) { - return new GetOperationRequest(properties); - }; - - /** - * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. - * @function encode - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetOperationRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetOperationRequest message from the specified reader or buffer. - * @function decode - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.GetOperationRequest} GetOperationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetOperationRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.GetOperationRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.GetOperationRequest} GetOperationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetOperationRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetOperationRequest message. - * @function verify - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetOperationRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {Object.} object Plain object - * @returns {google.longrunning.GetOperationRequest} GetOperationRequest - */ - GetOperationRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.GetOperationRequest) - return object; - var message = new $root.google.longrunning.GetOperationRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {google.longrunning.GetOperationRequest} message GetOperationRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetOperationRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetOperationRequest to JSON. - * @function toJSON - * @memberof google.longrunning.GetOperationRequest - * @instance - * @returns {Object.} JSON object - */ - GetOperationRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetOperationRequest - * @function getTypeUrl - * @memberof google.longrunning.GetOperationRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.longrunning.GetOperationRequest"; - }; - - return GetOperationRequest; - })(); - - longrunning.ListOperationsRequest = (function() { - - /** - * Properties of a ListOperationsRequest. - * @memberof google.longrunning - * @interface IListOperationsRequest - * @property {string|null} [name] ListOperationsRequest name - * @property {string|null} [filter] ListOperationsRequest filter - * @property {number|null} [pageSize] ListOperationsRequest pageSize - * @property {string|null} [pageToken] ListOperationsRequest pageToken - */ - - /** - * Constructs a new ListOperationsRequest. - * @memberof google.longrunning - * @classdesc Represents a ListOperationsRequest. - * @implements IListOperationsRequest - * @constructor - * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set - */ - function ListOperationsRequest(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]]; - } - - /** - * ListOperationsRequest name. - * @member {string} name - * @memberof google.longrunning.ListOperationsRequest - * @instance - */ - ListOperationsRequest.prototype.name = ""; - - /** - * ListOperationsRequest filter. - * @member {string} filter - * @memberof google.longrunning.ListOperationsRequest - * @instance - */ - ListOperationsRequest.prototype.filter = ""; - - /** - * ListOperationsRequest pageSize. - * @member {number} pageSize - * @memberof google.longrunning.ListOperationsRequest - * @instance - */ - ListOperationsRequest.prototype.pageSize = 0; - - /** - * ListOperationsRequest pageToken. - * @member {string} pageToken - * @memberof google.longrunning.ListOperationsRequest - * @instance - */ - ListOperationsRequest.prototype.pageToken = ""; - - /** - * Creates a new ListOperationsRequest instance using the specified properties. - * @function create - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set - * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest instance - */ - ListOperationsRequest.create = function create(properties) { - return new ListOperationsRequest(properties); - }; - - /** - * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. - * @function encode - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListOperationsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); - return writer; - }; - - /** - * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListOperationsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListOperationsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListOperationsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 4: { - message.name = reader.string(); - break; - } - case 1: { - message.filter = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListOperationsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListOperationsRequest message. - * @function verify - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListOperationsRequest.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.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - return null; - }; - - /** - * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest - */ - ListOperationsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.ListOperationsRequest) - return object; - var message = new $root.google.longrunning.ListOperationsRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.filter != null) - message.filter = String(object.filter); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - return message; - }; - - /** - * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {google.longrunning.ListOperationsRequest} message ListOperationsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListOperationsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.filter = ""; - object.pageSize = 0; - object.pageToken = ""; - object.name = ""; - } - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this ListOperationsRequest to JSON. - * @function toJSON - * @memberof google.longrunning.ListOperationsRequest - * @instance - * @returns {Object.} JSON object - */ - ListOperationsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListOperationsRequest - * @function getTypeUrl - * @memberof google.longrunning.ListOperationsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListOperationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.longrunning.ListOperationsRequest"; - }; - - return ListOperationsRequest; - })(); - - longrunning.ListOperationsResponse = (function() { - - /** - * Properties of a ListOperationsResponse. - * @memberof google.longrunning - * @interface IListOperationsResponse - * @property {Array.|null} [operations] ListOperationsResponse operations - * @property {string|null} [nextPageToken] ListOperationsResponse nextPageToken - */ - - /** - * Constructs a new ListOperationsResponse. - * @memberof google.longrunning - * @classdesc Represents a ListOperationsResponse. - * @implements IListOperationsResponse - * @constructor - * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set - */ - function ListOperationsResponse(properties) { - this.operations = []; - 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]]; - } - - /** - * ListOperationsResponse operations. - * @member {Array.} operations - * @memberof google.longrunning.ListOperationsResponse - * @instance - */ - ListOperationsResponse.prototype.operations = $util.emptyArray; - - /** - * ListOperationsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.longrunning.ListOperationsResponse - * @instance - */ - ListOperationsResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListOperationsResponse instance using the specified properties. - * @function create - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set - * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse instance - */ - ListOperationsResponse.create = function create(properties) { - return new ListOperationsResponse(properties); - }; - - /** - * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. - * @function encode - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListOperationsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operations != null && message.operations.length) - for (var i = 0; i < message.operations.length; ++i) - $root.google.longrunning.Operation.encode(message.operations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListOperationsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListOperationsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListOperationsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.operations && message.operations.length)) - message.operations = []; - message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListOperationsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListOperationsResponse message. - * @function verify - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListOperationsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operations != null && message.hasOwnProperty("operations")) { - if (!Array.isArray(message.operations)) - return "operations: array expected"; - for (var i = 0; i < message.operations.length; ++i) { - var error = $root.google.longrunning.Operation.verify(message.operations[i]); - if (error) - return "operations." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse - */ - ListOperationsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.ListOperationsResponse) - return object; - var message = new $root.google.longrunning.ListOperationsResponse(); - if (object.operations) { - if (!Array.isArray(object.operations)) - throw TypeError(".google.longrunning.ListOperationsResponse.operations: array expected"); - message.operations = []; - for (var i = 0; i < object.operations.length; ++i) { - if (typeof object.operations[i] !== "object") - throw TypeError(".google.longrunning.ListOperationsResponse.operations: object expected"); - message.operations[i] = $root.google.longrunning.Operation.fromObject(object.operations[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {google.longrunning.ListOperationsResponse} message ListOperationsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListOperationsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.operations = []; - if (options.defaults) - object.nextPageToken = ""; - if (message.operations && message.operations.length) { - object.operations = []; - for (var j = 0; j < message.operations.length; ++j) - object.operations[j] = $root.google.longrunning.Operation.toObject(message.operations[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this ListOperationsResponse to JSON. - * @function toJSON - * @memberof google.longrunning.ListOperationsResponse - * @instance - * @returns {Object.} JSON object - */ - ListOperationsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListOperationsResponse - * @function getTypeUrl - * @memberof google.longrunning.ListOperationsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListOperationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.longrunning.ListOperationsResponse"; - }; - - return ListOperationsResponse; - })(); - - longrunning.CancelOperationRequest = (function() { - - /** - * Properties of a CancelOperationRequest. - * @memberof google.longrunning - * @interface ICancelOperationRequest - * @property {string|null} [name] CancelOperationRequest name - */ - - /** - * Constructs a new CancelOperationRequest. - * @memberof google.longrunning - * @classdesc Represents a CancelOperationRequest. - * @implements ICancelOperationRequest - * @constructor - * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set - */ - function CancelOperationRequest(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]]; - } - - /** - * CancelOperationRequest name. - * @member {string} name - * @memberof google.longrunning.CancelOperationRequest - * @instance - */ - CancelOperationRequest.prototype.name = ""; - - /** - * Creates a new CancelOperationRequest instance using the specified properties. - * @function create - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set - * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest instance - */ - CancelOperationRequest.create = function create(properties) { - return new CancelOperationRequest(properties); - }; - - /** - * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. - * @function encode - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CancelOperationRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CancelOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CancelOperationRequest message from the specified reader or buffer. - * @function decode - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CancelOperationRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.CancelOperationRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CancelOperationRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CancelOperationRequest message. - * @function verify - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CancelOperationRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {Object.} object Plain object - * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest - */ - CancelOperationRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.CancelOperationRequest) - return object; - var message = new $root.google.longrunning.CancelOperationRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {google.longrunning.CancelOperationRequest} message CancelOperationRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CancelOperationRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this CancelOperationRequest to JSON. - * @function toJSON - * @memberof google.longrunning.CancelOperationRequest - * @instance - * @returns {Object.} JSON object - */ - CancelOperationRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CancelOperationRequest - * @function getTypeUrl - * @memberof google.longrunning.CancelOperationRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CancelOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.longrunning.CancelOperationRequest"; - }; - - return CancelOperationRequest; - })(); - - longrunning.DeleteOperationRequest = (function() { - - /** - * Properties of a DeleteOperationRequest. - * @memberof google.longrunning - * @interface IDeleteOperationRequest - * @property {string|null} [name] DeleteOperationRequest name - */ - - /** - * Constructs a new DeleteOperationRequest. - * @memberof google.longrunning - * @classdesc Represents a DeleteOperationRequest. - * @implements IDeleteOperationRequest - * @constructor - * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set - */ - function DeleteOperationRequest(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]]; - } - - /** - * DeleteOperationRequest name. - * @member {string} name - * @memberof google.longrunning.DeleteOperationRequest - * @instance - */ - DeleteOperationRequest.prototype.name = ""; - - /** - * Creates a new DeleteOperationRequest instance using the specified properties. - * @function create - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set - * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest instance - */ - DeleteOperationRequest.create = function create(properties) { - return new DeleteOperationRequest(properties); - }; - - /** - * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. - * @function encode - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteOperationRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteOperationRequest message from the specified reader or buffer. - * @function decode - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteOperationRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.DeleteOperationRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteOperationRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteOperationRequest message. - * @function verify - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteOperationRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {Object.} object Plain object - * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest - */ - DeleteOperationRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.DeleteOperationRequest) - return object; - var message = new $root.google.longrunning.DeleteOperationRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {google.longrunning.DeleteOperationRequest} message DeleteOperationRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteOperationRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteOperationRequest to JSON. - * @function toJSON - * @memberof google.longrunning.DeleteOperationRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteOperationRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteOperationRequest - * @function getTypeUrl - * @memberof google.longrunning.DeleteOperationRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.longrunning.DeleteOperationRequest"; - }; - - return DeleteOperationRequest; - })(); - - longrunning.WaitOperationRequest = (function() { - - /** - * Properties of a WaitOperationRequest. - * @memberof google.longrunning - * @interface IWaitOperationRequest - * @property {string|null} [name] WaitOperationRequest name - * @property {google.protobuf.IDuration|null} [timeout] WaitOperationRequest timeout - */ - - /** - * Constructs a new WaitOperationRequest. - * @memberof google.longrunning - * @classdesc Represents a WaitOperationRequest. - * @implements IWaitOperationRequest - * @constructor - * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set - */ - function WaitOperationRequest(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]]; - } - - /** - * WaitOperationRequest name. - * @member {string} name - * @memberof google.longrunning.WaitOperationRequest - * @instance - */ - WaitOperationRequest.prototype.name = ""; - - /** - * WaitOperationRequest timeout. - * @member {google.protobuf.IDuration|null|undefined} timeout - * @memberof google.longrunning.WaitOperationRequest - * @instance - */ - WaitOperationRequest.prototype.timeout = null; - - /** - * Creates a new WaitOperationRequest instance using the specified properties. - * @function create - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set - * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest instance - */ - WaitOperationRequest.create = function create(properties) { - return new WaitOperationRequest(properties); - }; - - /** - * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. - * @function encode - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WaitOperationRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) - $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WaitOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a WaitOperationRequest message from the specified reader or buffer. - * @function decode - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WaitOperationRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.WaitOperationRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - WaitOperationRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a WaitOperationRequest message. - * @function verify - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - WaitOperationRequest.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.timeout != null && message.hasOwnProperty("timeout")) { - var error = $root.google.protobuf.Duration.verify(message.timeout); - if (error) - return "timeout." + error; - } - return null; - }; - - /** - * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {Object.} object Plain object - * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest - */ - WaitOperationRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.WaitOperationRequest) - return object; - var message = new $root.google.longrunning.WaitOperationRequest(); - if (object.name != null) - message.name = String(object.name); - if (object.timeout != null) { - if (typeof object.timeout !== "object") - throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected"); - message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); - } - return message; - }; - - /** - * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {google.longrunning.WaitOperationRequest} message WaitOperationRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - WaitOperationRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.timeout = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.timeout != null && message.hasOwnProperty("timeout")) - object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); - return object; - }; - - /** - * Converts this WaitOperationRequest to JSON. - * @function toJSON - * @memberof google.longrunning.WaitOperationRequest - * @instance - * @returns {Object.} JSON object - */ - WaitOperationRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for WaitOperationRequest - * @function getTypeUrl - * @memberof google.longrunning.WaitOperationRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - WaitOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.longrunning.WaitOperationRequest"; - }; - - return WaitOperationRequest; - })(); - - longrunning.OperationInfo = (function() { - - /** - * Properties of an OperationInfo. - * @memberof google.longrunning - * @interface IOperationInfo - * @property {string|null} [responseType] OperationInfo responseType - * @property {string|null} [metadataType] OperationInfo metadataType - */ - - /** - * Constructs a new OperationInfo. - * @memberof google.longrunning - * @classdesc Represents an OperationInfo. - * @implements IOperationInfo - * @constructor - * @param {google.longrunning.IOperationInfo=} [properties] Properties to set - */ - function OperationInfo(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]]; - } - - /** - * OperationInfo responseType. - * @member {string} responseType - * @memberof google.longrunning.OperationInfo - * @instance - */ - OperationInfo.prototype.responseType = ""; - - /** - * OperationInfo metadataType. - * @member {string} metadataType - * @memberof google.longrunning.OperationInfo - * @instance - */ - OperationInfo.prototype.metadataType = ""; - - /** - * Creates a new OperationInfo instance using the specified properties. - * @function create - * @memberof google.longrunning.OperationInfo - * @static - * @param {google.longrunning.IOperationInfo=} [properties] Properties to set - * @returns {google.longrunning.OperationInfo} OperationInfo instance - */ - OperationInfo.create = function create(properties) { - return new OperationInfo(properties); - }; - - /** - * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. - * @function encode - * @memberof google.longrunning.OperationInfo - * @static - * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); - if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); - return writer; - }; - - /** - * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.longrunning.OperationInfo - * @static - * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationInfo message from the specified reader or buffer. - * @function decode - * @memberof google.longrunning.OperationInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.longrunning.OperationInfo} OperationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.OperationInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.responseType = reader.string(); - break; - } - case 2: { - message.metadataType = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.longrunning.OperationInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.longrunning.OperationInfo} OperationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationInfo message. - * @function verify - * @memberof google.longrunning.OperationInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OperationInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.responseType != null && message.hasOwnProperty("responseType")) - if (!$util.isString(message.responseType)) - return "responseType: string expected"; - if (message.metadataType != null && message.hasOwnProperty("metadataType")) - if (!$util.isString(message.metadataType)) - return "metadataType: string expected"; - return null; - }; - - /** - * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.longrunning.OperationInfo - * @static - * @param {Object.} object Plain object - * @returns {google.longrunning.OperationInfo} OperationInfo - */ - OperationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.longrunning.OperationInfo) - return object; - var message = new $root.google.longrunning.OperationInfo(); - if (object.responseType != null) - message.responseType = String(object.responseType); - if (object.metadataType != null) - message.metadataType = String(object.metadataType); - return message; - }; - - /** - * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.longrunning.OperationInfo - * @static - * @param {google.longrunning.OperationInfo} message OperationInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.responseType = ""; - object.metadataType = ""; - } - if (message.responseType != null && message.hasOwnProperty("responseType")) - object.responseType = message.responseType; - if (message.metadataType != null && message.hasOwnProperty("metadataType")) - object.metadataType = message.metadataType; - return object; - }; - - /** - * Converts this OperationInfo to JSON. - * @function toJSON - * @memberof google.longrunning.OperationInfo - * @instance - * @returns {Object.} JSON object - */ - OperationInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationInfo - * @function getTypeUrl - * @memberof google.longrunning.OperationInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.longrunning.OperationInfo"; - }; - - return OperationInfo; - })(); - - return longrunning; - })(); - - google.rpc = (function() { - - /** - * Namespace rpc. - * @memberof google - * @namespace - */ - var rpc = {}; - - rpc.Status = (function() { - - /** - * Properties of a Status. - * @memberof google.rpc - * @interface IStatus - * @property {number|null} [code] Status code - * @property {string|null} [message] Status message - * @property {Array.|null} [details] Status details - */ - - /** - * Constructs a new Status. - * @memberof google.rpc - * @classdesc Represents a Status. - * @implements IStatus - * @constructor - * @param {google.rpc.IStatus=} [properties] Properties to set - */ - function Status(properties) { - this.details = []; - 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]]; - } - - /** - * Status code. - * @member {number} code - * @memberof google.rpc.Status - * @instance - */ - Status.prototype.code = 0; - - /** - * Status message. - * @member {string} message - * @memberof google.rpc.Status - * @instance - */ - Status.prototype.message = ""; - - /** - * Status details. - * @member {Array.} details - * @memberof google.rpc.Status - * @instance - */ - Status.prototype.details = $util.emptyArray; - - /** - * Creates a new Status instance using the specified properties. - * @function create - * @memberof google.rpc.Status - * @static - * @param {google.rpc.IStatus=} [properties] Properties to set - * @returns {google.rpc.Status} Status instance - */ - Status.create = function create(properties) { - return new Status(properties); - }; - - /** - * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @function encode - * @memberof google.rpc.Status - * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Status.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.details != null && message.details.length) - for (var i = 0; i < message.details.length; ++i) - $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @function encodeDelimited - * @memberof google.rpc.Status - * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Status.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Status message from the specified reader or buffer. - * @function decode - * @memberof google.rpc.Status - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.rpc.Status} Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Status.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.code = reader.int32(); - break; - } - case 2: { - message.message = reader.string(); - break; - } - case 3: { - if (!(message.details && message.details.length)) - message.details = []; - message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Status message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.rpc.Status - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.rpc.Status} Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Status.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Status message. - * @function verify - * @memberof google.rpc.Status - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Status.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isInteger(message.code)) - return "code: integer expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.details != null && message.hasOwnProperty("details")) { - if (!Array.isArray(message.details)) - return "details: array expected"; - for (var i = 0; i < message.details.length; ++i) { - var error = $root.google.protobuf.Any.verify(message.details[i]); - if (error) - return "details." + error; - } - } - return null; - }; - - /** - * Creates a Status message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.rpc.Status - * @static - * @param {Object.} object Plain object - * @returns {google.rpc.Status} Status - */ - Status.fromObject = function fromObject(object) { - if (object instanceof $root.google.rpc.Status) - return object; - var message = new $root.google.rpc.Status(); - if (object.code != null) - message.code = object.code | 0; - if (object.message != null) - message.message = String(object.message); - if (object.details) { - if (!Array.isArray(object.details)) - throw TypeError(".google.rpc.Status.details: array expected"); - message.details = []; - for (var i = 0; i < object.details.length; ++i) { - if (typeof object.details[i] !== "object") - throw TypeError(".google.rpc.Status.details: object expected"); - message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Status message. Also converts values to other types if specified. - * @function toObject - * @memberof google.rpc.Status - * @static - * @param {google.rpc.Status} message Status - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Status.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.details = []; - if (options.defaults) { - object.code = 0; - object.message = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.details && message.details.length) { - object.details = []; - for (var j = 0; j < message.details.length; ++j) - object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); - } - return object; - }; - - /** - * Converts this Status to JSON. - * @function toJSON - * @memberof google.rpc.Status - * @instance - * @returns {Object.} JSON object - */ - Status.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Status - * @function getTypeUrl - * @memberof google.rpc.Status - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.rpc.Status"; - }; - - return Status; - })(); - - return rpc; - })(); - - google.type = (function() { - - /** - * Namespace type. - * @memberof google - * @namespace - */ - var type = {}; - - type.Color = (function() { - - /** - * Properties of a Color. - * @memberof google.type - * @interface IColor - * @property {number|null} [red] Color red - * @property {number|null} [green] Color green - * @property {number|null} [blue] Color blue - * @property {google.protobuf.IFloatValue|null} [alpha] Color alpha - */ - - /** - * Constructs a new Color. - * @memberof google.type - * @classdesc Represents a Color. - * @implements IColor - * @constructor - * @param {google.type.IColor=} [properties] Properties to set - */ - function Color(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]]; - } - - /** - * Color red. - * @member {number} red - * @memberof google.type.Color - * @instance - */ - Color.prototype.red = 0; - - /** - * Color green. - * @member {number} green - * @memberof google.type.Color - * @instance - */ - Color.prototype.green = 0; - - /** - * Color blue. - * @member {number} blue - * @memberof google.type.Color - * @instance - */ - Color.prototype.blue = 0; - - /** - * Color alpha. - * @member {google.protobuf.IFloatValue|null|undefined} alpha - * @memberof google.type.Color - * @instance - */ - Color.prototype.alpha = null; - - /** - * Creates a new Color instance using the specified properties. - * @function create - * @memberof google.type.Color - * @static - * @param {google.type.IColor=} [properties] Properties to set - * @returns {google.type.Color} Color instance - */ - Color.create = function create(properties) { - return new Color(properties); - }; - - /** - * Encodes the specified Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. - * @function encode - * @memberof google.type.Color - * @static - * @param {google.type.IColor} message Color message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Color.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.red != null && Object.hasOwnProperty.call(message, "red")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.red); - if (message.green != null && Object.hasOwnProperty.call(message, "green")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.green); - if (message.blue != null && Object.hasOwnProperty.call(message, "blue")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.blue); - if (message.alpha != null && Object.hasOwnProperty.call(message, "alpha")) - $root.google.protobuf.FloatValue.encode(message.alpha, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. - * @function encodeDelimited - * @memberof google.type.Color - * @static - * @param {google.type.IColor} message Color message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Color.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Color message from the specified reader or buffer. - * @function decode - * @memberof google.type.Color - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.type.Color} Color - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Color.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Color(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.red = reader.float(); - break; - } - case 2: { - message.green = reader.float(); - break; - } - case 3: { - message.blue = reader.float(); - break; - } - case 4: { - message.alpha = $root.google.protobuf.FloatValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Color message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.type.Color - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.type.Color} Color - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Color.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Color message. - * @function verify - * @memberof google.type.Color - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Color.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.red != null && message.hasOwnProperty("red")) - if (typeof message.red !== "number") - return "red: number expected"; - if (message.green != null && message.hasOwnProperty("green")) - if (typeof message.green !== "number") - return "green: number expected"; - if (message.blue != null && message.hasOwnProperty("blue")) - if (typeof message.blue !== "number") - return "blue: number expected"; - if (message.alpha != null && message.hasOwnProperty("alpha")) { - var error = $root.google.protobuf.FloatValue.verify(message.alpha); - if (error) - return "alpha." + error; - } - return null; - }; - - /** - * Creates a Color message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.type.Color - * @static - * @param {Object.} object Plain object - * @returns {google.type.Color} Color - */ - Color.fromObject = function fromObject(object) { - if (object instanceof $root.google.type.Color) - return object; - var message = new $root.google.type.Color(); - if (object.red != null) - message.red = Number(object.red); - if (object.green != null) - message.green = Number(object.green); - if (object.blue != null) - message.blue = Number(object.blue); - if (object.alpha != null) { - if (typeof object.alpha !== "object") - throw TypeError(".google.type.Color.alpha: object expected"); - message.alpha = $root.google.protobuf.FloatValue.fromObject(object.alpha); - } - return message; - }; - - /** - * Creates a plain object from a Color message. Also converts values to other types if specified. - * @function toObject - * @memberof google.type.Color - * @static - * @param {google.type.Color} message Color - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Color.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.red = 0; - object.green = 0; - object.blue = 0; - object.alpha = null; - } - if (message.red != null && message.hasOwnProperty("red")) - object.red = options.json && !isFinite(message.red) ? String(message.red) : message.red; - if (message.green != null && message.hasOwnProperty("green")) - object.green = options.json && !isFinite(message.green) ? String(message.green) : message.green; - if (message.blue != null && message.hasOwnProperty("blue")) - object.blue = options.json && !isFinite(message.blue) ? String(message.blue) : message.blue; - if (message.alpha != null && message.hasOwnProperty("alpha")) - object.alpha = $root.google.protobuf.FloatValue.toObject(message.alpha, options); - return object; - }; - - /** - * Converts this Color to JSON. - * @function toJSON - * @memberof google.type.Color - * @instance - * @returns {Object.} JSON object - */ - Color.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Color - * @function getTypeUrl - * @memberof google.type.Color - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Color.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.type.Color"; - }; - - return Color; - })(); - - type.LatLng = (function() { - - /** - * Properties of a LatLng. - * @memberof google.type - * @interface ILatLng - * @property {number|null} [latitude] LatLng latitude - * @property {number|null} [longitude] LatLng longitude - */ - - /** - * Constructs a new LatLng. - * @memberof google.type - * @classdesc Represents a LatLng. - * @implements ILatLng - * @constructor - * @param {google.type.ILatLng=} [properties] Properties to set - */ - function LatLng(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]]; - } - - /** - * LatLng latitude. - * @member {number} latitude - * @memberof google.type.LatLng - * @instance - */ - LatLng.prototype.latitude = 0; - - /** - * LatLng longitude. - * @member {number} longitude - * @memberof google.type.LatLng - * @instance - */ - LatLng.prototype.longitude = 0; - - /** - * Creates a new LatLng instance using the specified properties. - * @function create - * @memberof google.type.LatLng - * @static - * @param {google.type.ILatLng=} [properties] Properties to set - * @returns {google.type.LatLng} LatLng instance - */ - LatLng.create = function create(properties) { - return new LatLng(properties); - }; - - /** - * Encodes the specified LatLng message. Does not implicitly {@link google.type.LatLng.verify|verify} messages. - * @function encode - * @memberof google.type.LatLng - * @static - * @param {google.type.ILatLng} message LatLng message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LatLng.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latitude != null && Object.hasOwnProperty.call(message, "latitude")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.latitude); - if (message.longitude != null && Object.hasOwnProperty.call(message, "longitude")) - writer.uint32(/* id 2, wireType 1 =*/17).double(message.longitude); - return writer; - }; - - /** - * Encodes the specified LatLng message, length delimited. Does not implicitly {@link google.type.LatLng.verify|verify} messages. - * @function encodeDelimited - * @memberof google.type.LatLng - * @static - * @param {google.type.ILatLng} message LatLng message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LatLng.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LatLng message from the specified reader or buffer. - * @function decode - * @memberof google.type.LatLng - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.type.LatLng} LatLng - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LatLng.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.LatLng(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.latitude = reader.double(); - break; - } - case 2: { - message.longitude = reader.double(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LatLng message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.type.LatLng - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.type.LatLng} LatLng - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LatLng.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LatLng message. - * @function verify - * @memberof google.type.LatLng - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LatLng.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.latitude != null && message.hasOwnProperty("latitude")) - if (typeof message.latitude !== "number") - return "latitude: number expected"; - if (message.longitude != null && message.hasOwnProperty("longitude")) - if (typeof message.longitude !== "number") - return "longitude: number expected"; - return null; - }; - - /** - * Creates a LatLng message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.type.LatLng - * @static - * @param {Object.} object Plain object - * @returns {google.type.LatLng} LatLng - */ - LatLng.fromObject = function fromObject(object) { - if (object instanceof $root.google.type.LatLng) - return object; - var message = new $root.google.type.LatLng(); - if (object.latitude != null) - message.latitude = Number(object.latitude); - if (object.longitude != null) - message.longitude = Number(object.longitude); - return message; - }; - - /** - * Creates a plain object from a LatLng message. Also converts values to other types if specified. - * @function toObject - * @memberof google.type.LatLng - * @static - * @param {google.type.LatLng} message LatLng - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LatLng.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.latitude = 0; - object.longitude = 0; - } - if (message.latitude != null && message.hasOwnProperty("latitude")) - object.latitude = options.json && !isFinite(message.latitude) ? String(message.latitude) : message.latitude; - if (message.longitude != null && message.hasOwnProperty("longitude")) - object.longitude = options.json && !isFinite(message.longitude) ? String(message.longitude) : message.longitude; - return object; - }; - - /** - * Converts this LatLng to JSON. - * @function toJSON - * @memberof google.type.LatLng - * @instance - * @returns {Object.} JSON object - */ - LatLng.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LatLng - * @function getTypeUrl - * @memberof google.type.LatLng - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LatLng.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.type.LatLng"; - }; - - return LatLng; - })(); - - return type; - })(); - - return google; - })(); - - return $root; -}); diff --git a/protos/protos.json b/protos/protos.json deleted file mode 100644 index c0f5748a..00000000 --- a/protos/protos.json +++ /dev/null @@ -1,10222 +0,0 @@ -{ - "nested": { - "google": { - "nested": { - "cloud": { - "nested": { - "vision": { - "nested": { - "v1": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/cloud/vision/v1;vision", - "java_multiple_files": true, - "java_outer_classname": "WebDetectionProto", - "java_package": "com.google.cloud.vision.v1", - "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", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-vision" - }, - "methods": { - "BatchAnnotateImages": { - "requestType": "BatchAnnotateImagesRequest", - "responseType": "BatchAnnotateImagesResponse", - "options": { - "(google.api.http).post": "/v1/images:annotate", - "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v1/{parent=projects/*}/images:annotate", - "(google.api.http).additional_bindings.body": "*", - "(google.api.method_signature)": "requests" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/images:annotate", - "body": "*", - "additional_bindings": [ - { - "post": "/v1/{parent=projects/*/locations/*}/images:annotate", - "body": "*" - }, - { - "post": "/v1/{parent=projects/*}/images:annotate", - "body": "*" - } - ] - } - }, - { - "(google.api.method_signature)": "requests" - } - ] - }, - "BatchAnnotateFiles": { - "requestType": "BatchAnnotateFilesRequest", - "responseType": "BatchAnnotateFilesResponse", - "options": { - "(google.api.http).post": "/v1/files:annotate", - "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v1/{parent=projects/*}/files:annotate", - "(google.api.http).additional_bindings.body": "*", - "(google.api.method_signature)": "requests" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/files:annotate", - "body": "*", - "additional_bindings": [ - { - "post": "/v1/{parent=projects/*/locations/*}/files:annotate", - "body": "*" - }, - { - "post": "/v1/{parent=projects/*}/files:annotate", - "body": "*" - } - ] - } - }, - { - "(google.api.method_signature)": "requests" - } - ] - }, - "AsyncBatchAnnotateImages": { - "requestType": "AsyncBatchAnnotateImagesRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1/images:asyncBatchAnnotate", - "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v1/{parent=projects/*}/images:asyncBatchAnnotate", - "(google.api.http).additional_bindings.body": "*", - "(google.api.method_signature)": "requests,output_config", - "(google.longrunning.operation_info).response_type": "AsyncBatchAnnotateImagesResponse", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/images:asyncBatchAnnotate", - "body": "*", - "additional_bindings": [ - { - "post": "/v1/{parent=projects/*/locations/*}/images:asyncBatchAnnotate", - "body": "*" - }, - { - "post": "/v1/{parent=projects/*}/images:asyncBatchAnnotate", - "body": "*" - } - ] - } - }, - { - "(google.api.method_signature)": "requests,output_config" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "AsyncBatchAnnotateImagesResponse", - "metadata_type": "OperationMetadata" - } - } - ] - }, - "AsyncBatchAnnotateFiles": { - "requestType": "AsyncBatchAnnotateFilesRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1/files:asyncBatchAnnotate", - "(google.api.http).body": "*", - "(google.api.http).additional_bindings.post": "/v1/{parent=projects/*}/files:asyncBatchAnnotate", - "(google.api.http).additional_bindings.body": "*", - "(google.api.method_signature)": "requests", - "(google.longrunning.operation_info).response_type": "AsyncBatchAnnotateFilesResponse", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/files:asyncBatchAnnotate", - "body": "*", - "additional_bindings": [ - { - "post": "/v1/{parent=projects/*/locations/*}/files:asyncBatchAnnotate", - "body": "*" - }, - { - "post": "/v1/{parent=projects/*}/files:asyncBatchAnnotate", - "body": "*" - } - ] - } - }, - { - "(google.api.method_signature)": "requests" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "AsyncBatchAnnotateFilesResponse", - "metadata_type": "OperationMetadata" - } - } - ] - } - } - }, - "Likelihood": { - "values": { - "UNKNOWN": 0, - "VERY_UNLIKELY": 1, - "UNLIKELY": 2, - "POSSIBLE": 3, - "LIKELY": 4, - "VERY_LIKELY": 5 - } - }, - "Feature": { - "fields": { - "type": { - "type": "Type", - "id": 1 - }, - "maxResults": { - "type": "int32", - "id": 2 - }, - "model": { - "type": "string", - "id": 3 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - }, - "ImageSource": { - "fields": { - "gcsImageUri": { - "type": "string", - "id": 1 - }, - "imageUri": { - "type": "string", - "id": 2 - } - } - }, - "Image": { - "fields": { - "content": { - "type": "bytes", - "id": 1 - }, - "source": { - "type": "ImageSource", - "id": 2 - } - } - }, - "FaceAnnotation": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "fdBoundingPoly": { - "type": "BoundingPoly", - "id": 2 - }, - "landmarks": { - "rule": "repeated", - "type": "Landmark", - "id": 3 - }, - "rollAngle": { - "type": "float", - "id": 4 - }, - "panAngle": { - "type": "float", - "id": 5 - }, - "tiltAngle": { - "type": "float", - "id": 6 - }, - "detectionConfidence": { - "type": "float", - "id": 7 - }, - "landmarkingConfidence": { - "type": "float", - "id": 8 - }, - "joyLikelihood": { - "type": "Likelihood", - "id": 9 - }, - "sorrowLikelihood": { - "type": "Likelihood", - "id": 10 - }, - "angerLikelihood": { - "type": "Likelihood", - "id": 11 - }, - "surpriseLikelihood": { - "type": "Likelihood", - "id": 12 - }, - "underExposedLikelihood": { - "type": "Likelihood", - "id": 13 - }, - "blurredLikelihood": { - "type": "Likelihood", - "id": 14 - }, - "headwearLikelihood": { - "type": "Likelihood", - "id": 15 - } - }, - "nested": { - "Landmark": { - "fields": { - "type": { - "type": "Type", - "id": 3 - }, - "position": { - "type": "Position", - "id": 4 - } - }, - "nested": { - "Type": { - "values": { - "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, - "LEFT_CHEEK_CENTER": 35, - "RIGHT_CHEEK_CENTER": 36 - } - } - } - } - } - }, - "LocationInfo": { - "fields": { - "latLng": { - "type": "google.type.LatLng", - "id": 1 - } - } - }, - "Property": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - }, - "uint64Value": { - "type": "uint64", - "id": 3 - } - } - }, - "EntityAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "locale": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5, - "options": { - "deprecated": true - } - }, - "topicality": { - "type": "float", - "id": 6 - }, - "boundingPoly": { - "type": "BoundingPoly", - "id": 7 - }, - "locations": { - "rule": "repeated", - "type": "LocationInfo", - "id": 8 - }, - "properties": { - "rule": "repeated", - "type": "Property", - "id": 9 - } - } - }, - "LocalizedObjectAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - }, - "boundingPoly": { - "type": "BoundingPoly", - "id": 5 - } - } - }, - "SafeSearchAnnotation": { - "fields": { - "adult": { - "type": "Likelihood", - "id": 1 - }, - "spoof": { - "type": "Likelihood", - "id": 2 - }, - "medical": { - "type": "Likelihood", - "id": 3 - }, - "violence": { - "type": "Likelihood", - "id": 4 - }, - "racy": { - "type": "Likelihood", - "id": 9 - } - } - }, - "LatLongRect": { - "fields": { - "minLatLng": { - "type": "google.type.LatLng", - "id": 1 - }, - "maxLatLng": { - "type": "google.type.LatLng", - "id": 2 - } - } - }, - "ColorInfo": { - "fields": { - "color": { - "type": "google.type.Color", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pixelFraction": { - "type": "float", - "id": 3 - } - } - }, - "DominantColorsAnnotation": { - "fields": { - "colors": { - "rule": "repeated", - "type": "ColorInfo", - "id": 1 - } - } - }, - "ImageProperties": { - "fields": { - "dominantColors": { - "type": "DominantColorsAnnotation", - "id": 1 - } - } - }, - "CropHint": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - }, - "importanceFraction": { - "type": "float", - "id": 3 - } - } - }, - "CropHintsAnnotation": { - "fields": { - "cropHints": { - "rule": "repeated", - "type": "CropHint", - "id": 1 - } - } - }, - "CropHintsParams": { - "fields": { - "aspectRatios": { - "rule": "repeated", - "type": "float", - "id": 1 - } - } - }, - "WebDetectionParams": { - "fields": { - "includeGeoResults": { - "type": "bool", - "id": 2 - } - } - }, - "TextDetectionParams": { - "fields": { - "enableTextDetectionConfidenceScore": { - "type": "bool", - "id": 9 - }, - "advancedOcrOptions": { - "rule": "repeated", - "type": "string", - "id": 11 - } - } - }, - "ImageContext": { - "fields": { - "latLongRect": { - "type": "LatLongRect", - "id": 1 - }, - "languageHints": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "cropHintsParams": { - "type": "CropHintsParams", - "id": 4 - }, - "productSearchParams": { - "type": "ProductSearchParams", - "id": 5 - }, - "webDetectionParams": { - "type": "WebDetectionParams", - "id": 6 - }, - "textDetectionParams": { - "type": "TextDetectionParams", - "id": 12 - } - } - }, - "AnnotateImageRequest": { - "fields": { - "image": { - "type": "Image", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - } - } - }, - "ImageAnnotationContext": { - "fields": { - "uri": { - "type": "string", - "id": 1 - }, - "pageNumber": { - "type": "int32", - "id": 2 - } - } - }, - "AnnotateImageResponse": { - "fields": { - "faceAnnotations": { - "rule": "repeated", - "type": "FaceAnnotation", - "id": 1 - }, - "landmarkAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 2 - }, - "logoAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 3 - }, - "labelAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 4 - }, - "localizedObjectAnnotations": { - "rule": "repeated", - "type": "LocalizedObjectAnnotation", - "id": 22 - }, - "textAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 5 - }, - "fullTextAnnotation": { - "type": "TextAnnotation", - "id": 12 - }, - "safeSearchAnnotation": { - "type": "SafeSearchAnnotation", - "id": 6 - }, - "imagePropertiesAnnotation": { - "type": "ImageProperties", - "id": 8 - }, - "cropHintsAnnotation": { - "type": "CropHintsAnnotation", - "id": 11 - }, - "webDetection": { - "type": "WebDetection", - "id": 13 - }, - "productSearchResults": { - "type": "ProductSearchResults", - "id": 14 - }, - "error": { - "type": "google.rpc.Status", - "id": 9 - }, - "context": { - "type": "ImageAnnotationContext", - "id": 21 - } - } - }, - "BatchAnnotateImagesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateImageRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "parent": { - "type": "string", - "id": 4 - } - } - }, - "BatchAnnotateImagesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 1 - } - } - }, - "AnnotateFileRequest": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - }, - "pages": { - "rule": "repeated", - "type": "int32", - "id": 4 - } - } - }, - "AnnotateFileResponse": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 2 - }, - "totalPages": { - "type": "int32", - "id": 3 - }, - "error": { - "type": "google.rpc.Status", - "id": 4 - } - } - }, - "BatchAnnotateFilesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateFileRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "parent": { - "type": "string", - "id": 3 - } - } - }, - "BatchAnnotateFilesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AnnotateFileResponse", - "id": 1 - } - } - }, - "AsyncAnnotateFileRequest": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - }, - "outputConfig": { - "type": "OutputConfig", - "id": 4 - } - } - }, - "AsyncAnnotateFileResponse": { - "fields": { - "outputConfig": { - "type": "OutputConfig", - "id": 1 - } - } - }, - "AsyncBatchAnnotateImagesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateImageRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "outputConfig": { - "type": "OutputConfig", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "parent": { - "type": "string", - "id": 4 - } - } - }, - "AsyncBatchAnnotateImagesResponse": { - "fields": { - "outputConfig": { - "type": "OutputConfig", - "id": 1 - } - } - }, - "AsyncBatchAnnotateFilesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AsyncAnnotateFileRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "parent": { - "type": "string", - "id": 4 - } - } - }, - "AsyncBatchAnnotateFilesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AsyncAnnotateFileResponse", - "id": 1 - } - } - }, - "InputConfig": { - "fields": { - "gcsSource": { - "type": "GcsSource", - "id": 1 - }, - "content": { - "type": "bytes", - "id": 3 - }, - "mimeType": { - "type": "string", - "id": 2 - } - } - }, - "OutputConfig": { - "fields": { - "gcsDestination": { - "type": "GcsDestination", - "id": 1 - }, - "batchSize": { - "type": "int32", - "id": 2 - } - } - }, - "GcsSource": { - "fields": { - "uri": { - "type": "string", - "id": 1 - } - } - }, - "GcsDestination": { - "fields": { - "uri": { - "type": "string", - "id": 1 - } - } - }, - "OperationMetadata": { - "fields": { - "state": { - "type": "State", - "id": 1 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "CREATED": 1, - "RUNNING": 2, - "DONE": 3, - "CANCELLED": 4 - } - } - } - }, - "ProductSearchParams": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 9 - }, - "productSet": { - "type": "string", - "id": 6, - "options": { - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "productCategories": { - "rule": "repeated", - "type": "string", - "id": 7 - }, - "filter": { - "type": "string", - "id": 8 - } - } - }, - "ProductSearchResults": { - "fields": { - "indexTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "results": { - "rule": "repeated", - "type": "Result", - "id": 5 - }, - "productGroupedResults": { - "rule": "repeated", - "type": "GroupedResult", - "id": 6 - } - }, - "nested": { - "Result": { - "fields": { - "product": { - "type": "Product", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "image": { - "type": "string", - "id": 3 - } - } - }, - "ObjectAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - } - } - }, - "GroupedResult": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "results": { - "rule": "repeated", - "type": "Result", - "id": 2 - }, - "objectAnnotations": { - "rule": "repeated", - "type": "ObjectAnnotation", - "id": 3 - } - } - } - } - }, - "ProductSearch": { - "options": { - "(google.api.default_host)": "vision.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-vision" - }, - "methods": { - "CreateProductSet": { - "requestType": "CreateProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/productSets", - "(google.api.http).body": "product_set", - "(google.api.method_signature)": "parent,product_set,product_set_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*/locations/*}/productSets", - "body": "product_set" - } - }, - { - "(google.api.method_signature)": "parent,product_set,product_set_id" - } - ] - }, - "ListProductSets": { - "requestType": "ListProductSetsRequest", - "responseType": "ListProductSetsResponse", - "options": { - "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/productSets", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{parent=projects/*/locations/*}/productSets" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetProductSet": { - "requestType": "GetProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).get": "/v1/{name=projects/*/locations/*/productSets/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/locations/*/productSets/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "UpdateProductSet": { - "requestType": "UpdateProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).patch": "/v1/{product_set.name=projects/*/locations/*/productSets/*}", - "(google.api.http).body": "product_set", - "(google.api.method_signature)": "product_set,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1/{product_set.name=projects/*/locations/*/productSets/*}", - "body": "product_set" - } - }, - { - "(google.api.method_signature)": "product_set,update_mask" - } - ] - }, - "DeleteProductSet": { - "requestType": "DeleteProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1/{name=projects/*/locations/*/productSets/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=projects/*/locations/*/productSets/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*/locations/*}/products", - "body": "product" - } - }, - { - "(google.api.method_signature)": "parent,product,product_id" - } - ] - }, - "ListProducts": { - "requestType": "ListProductsRequest", - "responseType": "ListProductsResponse", - "options": { - "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/products", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{parent=projects/*/locations/*}/products" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetProduct": { - "requestType": "GetProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).get": "/v1/{name=projects/*/locations/*/products/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/locations/*/products/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "UpdateProduct": { - "requestType": "UpdateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).patch": "/v1/{product.name=projects/*/locations/*/products/*}", - "(google.api.http).body": "product", - "(google.api.method_signature)": "product,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1/{product.name=projects/*/locations/*/products/*}", - "body": "product" - } - }, - { - "(google.api.method_signature)": "product,update_mask" - } - ] - }, - "DeleteProduct": { - "requestType": "DeleteProductRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1/{name=projects/*/locations/*/products/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=projects/*/locations/*/products/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CreateReferenceImage": { - "requestType": "CreateReferenceImageRequest", - "responseType": "ReferenceImage", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*/locations/*/products/*}/referenceImages", - "(google.api.http).body": "reference_image", - "(google.api.method_signature)": "parent,reference_image,reference_image_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*/locations/*/products/*}/referenceImages", - "body": "reference_image" - } - }, - { - "(google.api.method_signature)": "parent,reference_image,reference_image_id" - } - ] - }, - "DeleteReferenceImage": { - "requestType": "DeleteReferenceImageRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1/{name=projects/*/locations/*/products/*/referenceImages/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=projects/*/locations/*/products/*/referenceImages/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ListReferenceImages": { - "requestType": "ListReferenceImagesRequest", - "responseType": "ListReferenceImagesResponse", - "options": { - "(google.api.http).get": "/v1/{parent=projects/*/locations/*/products/*}/referenceImages", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{parent=projects/*/locations/*/products/*}/referenceImages" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetReferenceImage": { - "requestType": "GetReferenceImageRequest", - "responseType": "ReferenceImage", - "options": { - "(google.api.http).get": "/v1/{name=projects/*/locations/*/products/*/referenceImages/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/locations/*/products/*/referenceImages/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "AddProductToProductSet": { - "requestType": "AddProductToProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1/{name=projects/*/locations/*/productSets/*}:addProduct", - "(google.api.http).body": "*", - "(google.api.method_signature)": "name,product" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{name=projects/*/locations/*/productSets/*}:addProduct", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name,product" - } - ] - }, - "RemoveProductFromProductSet": { - "requestType": "RemoveProductFromProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1/{name=projects/*/locations/*/productSets/*}:removeProduct", - "(google.api.http).body": "*", - "(google.api.method_signature)": "name,product" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{name=projects/*/locations/*/productSets/*}:removeProduct", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name,product" - } - ] - }, - "ListProductsInProductSet": { - "requestType": "ListProductsInProductSetRequest", - "responseType": "ListProductsInProductSetResponse", - "options": { - "(google.api.http).get": "/v1/{name=projects/*/locations/*/productSets/*}/products", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/locations/*/productSets/*}/products" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ImportProductSets": { - "requestType": "ImportProductSetsRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/productSets:import", - "(google.api.http).body": "*", - "(google.api.method_signature)": "parent,input_config", - "(google.longrunning.operation_info).response_type": "ImportProductSetsResponse", - "(google.longrunning.operation_info).metadata_type": "BatchOperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*/locations/*}/productSets:import", - "body": "*" - } - }, - { - "(google.api.method_signature)": "parent,input_config" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "ImportProductSetsResponse", - "metadata_type": "BatchOperationMetadata" - } - } - ] - }, - "PurgeProducts": { - "requestType": "PurgeProductsRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/products:purge", - "(google.api.http).body": "*", - "(google.api.method_signature)": "parent", - "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", - "(google.longrunning.operation_info).metadata_type": "BatchOperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*/locations/*}/products:purge", - "body": "*" - } - }, - { - "(google.api.method_signature)": "parent" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.protobuf.Empty", - "metadata_type": "BatchOperationMetadata" - } - } - ] - } - } - }, - "Product": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/Product", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/products/{product}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "displayName": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "productCategory": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "IMMUTABLE" - } - }, - "productLabels": { - "rule": "repeated", - "type": "KeyValue", - "id": 5 - } - }, - "nested": { - "KeyValue": { - "fields": { - "key": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - } - } - } - } - }, - "ProductSet": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/ProductSet", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/productSets/{product_set}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "displayName": { - "type": "string", - "id": 2 - }, - "indexTime": { - "type": "google.protobuf.Timestamp", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "indexError": { - "type": "google.rpc.Status", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "ReferenceImage": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/ReferenceImage", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "uri": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "boundingPolys": { - "rule": "repeated", - "type": "BoundingPoly", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "CreateProductRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "product": { - "type": "Product", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "productId": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsResponse": { - "fields": { - "products": { - "rule": "repeated", - "type": "Product", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetProductRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "UpdateProductRequest": { - "fields": { - "product": { - "type": "Product", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "DeleteProductRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "CreateProductSetRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "productSet": { - "type": "ProductSet", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "productSetId": { - "type": "string", - "id": 3 - } - } - }, - "ListProductSetsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductSetsResponse": { - "fields": { - "productSets": { - "rule": "repeated", - "type": "ProductSet", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - } - } - }, - "UpdateProductSetRequest": { - "fields": { - "productSet": { - "type": "ProductSet", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "DeleteProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - } - } - }, - "CreateReferenceImageRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - }, - "referenceImage": { - "type": "ReferenceImage", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "referenceImageId": { - "type": "string", - "id": 3 - } - } - }, - "ListReferenceImagesRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListReferenceImagesResponse": { - "fields": { - "referenceImages": { - "rule": "repeated", - "type": "ReferenceImage", - "id": 1 - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3 - } - } - }, - "GetReferenceImageRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ReferenceImage" - } - } - } - }, - "DeleteReferenceImageRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ReferenceImage" - } - } - } - }, - "AddProductToProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "product": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "RemoveProductFromProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "product": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "ListProductsInProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsInProductSetResponse": { - "fields": { - "products": { - "rule": "repeated", - "type": "Product", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "ImportProductSetsGcsSource": { - "fields": { - "csvFileUri": { - "type": "string", - "id": 1 - } - } - }, - "ImportProductSetsInputConfig": { - "oneofs": { - "source": { - "oneof": [ - "gcsSource" - ] - } - }, - "fields": { - "gcsSource": { - "type": "ImportProductSetsGcsSource", - "id": 1 - } - } - }, - "ImportProductSetsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "inputConfig": { - "type": "ImportProductSetsInputConfig", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "ImportProductSetsResponse": { - "fields": { - "referenceImages": { - "rule": "repeated", - "type": "ReferenceImage", - "id": 1 - }, - "statuses": { - "rule": "repeated", - "type": "google.rpc.Status", - "id": 2 - } - } - }, - "BatchOperationMetadata": { - "fields": { - "state": { - "type": "State", - "id": 1 - }, - "submitTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "PROCESSING": 1, - "SUCCESSFUL": 2, - "FAILED": 3, - "CANCELLED": 4 - } - } - } - }, - "ProductSetPurgeConfig": { - "fields": { - "productSetId": { - "type": "string", - "id": 1 - } - } - }, - "PurgeProductsRequest": { - "oneofs": { - "target": { - "oneof": [ - "productSetPurgeConfig", - "deleteOrphanProducts" - ] - } - }, - "fields": { - "productSetPurgeConfig": { - "type": "ProductSetPurgeConfig", - "id": 2 - }, - "deleteOrphanProducts": { - "type": "bool", - "id": 3 - }, - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "force": { - "type": "bool", - "id": 4 - } - } - }, - "TextAnnotation": { - "fields": { - "pages": { - "rule": "repeated", - "type": "Page", - "id": 1 - }, - "text": { - "type": "string", - "id": 2 - } - }, - "nested": { - "DetectedLanguage": { - "fields": { - "languageCode": { - "type": "string", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - } - } - }, - "DetectedBreak": { - "fields": { - "type": { - "type": "BreakType", - "id": 1 - }, - "isPrefix": { - "type": "bool", - "id": 2 - } - }, - "nested": { - "BreakType": { - "values": { - "UNKNOWN": 0, - "SPACE": 1, - "SURE_SPACE": 2, - "EOL_SURE_SPACE": 3, - "HYPHEN": 4, - "LINE_BREAK": 5 - } - } - } - }, - "TextProperty": { - "fields": { - "detectedLanguages": { - "rule": "repeated", - "type": "DetectedLanguage", - "id": 1 - }, - "detectedBreak": { - "type": "DetectedBreak", - "id": 2 - } - } - } - } - }, - "Page": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "width": { - "type": "int32", - "id": 2 - }, - "height": { - "type": "int32", - "id": 3 - }, - "blocks": { - "rule": "repeated", - "type": "Block", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - } - }, - "Block": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "paragraphs": { - "rule": "repeated", - "type": "Paragraph", - "id": 3 - }, - "blockType": { - "type": "BlockType", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - }, - "nested": { - "BlockType": { - "values": { - "UNKNOWN": 0, - "TEXT": 1, - "TABLE": 2, - "PICTURE": 3, - "RULER": 4, - "BARCODE": 5 - } - } - } - }, - "Paragraph": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "words": { - "rule": "repeated", - "type": "Word", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Word": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "symbols": { - "rule": "repeated", - "type": "Symbol", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Symbol": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "text": { - "type": "string", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "WebDetection": { - "fields": { - "webEntities": { - "rule": "repeated", - "type": "WebEntity", - "id": 1 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 2 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 3 - }, - "pagesWithMatchingImages": { - "rule": "repeated", - "type": "WebPage", - "id": 4 - }, - "visuallySimilarImages": { - "rule": "repeated", - "type": "WebImage", - "id": 6 - }, - "bestGuessLabels": { - "rule": "repeated", - "type": "WebLabel", - "id": 8 - } - }, - "nested": { - "WebEntity": { - "fields": { - "entityId": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - } - } - }, - "WebImage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - } - } - }, - "WebPage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pageTitle": { - "type": "string", - "id": 3 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 4 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 5 - } - } - }, - "WebLabel": { - "fields": { - "label": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - } - } - } - } - } - } - }, - "v1p1beta1": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1;vision", - "java_multiple_files": true, - "java_outer_classname": "WebDetectionProto", - "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", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-vision" - }, - "methods": { - "BatchAnnotateImages": { - "requestType": "BatchAnnotateImagesRequest", - "responseType": "BatchAnnotateImagesResponse", - "options": { - "(google.api.http).post": "/v1p1beta1/images:annotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p1beta1/images:annotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests" - } - ] - } - } - }, - "Feature": { - "fields": { - "type": { - "type": "Type", - "id": 1 - }, - "maxResults": { - "type": "int32", - "id": 2 - }, - "model": { - "type": "string", - "id": 3 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - }, - "ImageSource": { - "fields": { - "gcsImageUri": { - "type": "string", - "id": 1 - }, - "imageUri": { - "type": "string", - "id": 2 - } - } - }, - "Image": { - "fields": { - "content": { - "type": "bytes", - "id": 1 - }, - "source": { - "type": "ImageSource", - "id": 2 - } - } - }, - "FaceAnnotation": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "fdBoundingPoly": { - "type": "BoundingPoly", - "id": 2 - }, - "landmarks": { - "rule": "repeated", - "type": "Landmark", - "id": 3 - }, - "rollAngle": { - "type": "float", - "id": 4 - }, - "panAngle": { - "type": "float", - "id": 5 - }, - "tiltAngle": { - "type": "float", - "id": 6 - }, - "detectionConfidence": { - "type": "float", - "id": 7 - }, - "landmarkingConfidence": { - "type": "float", - "id": 8 - }, - "joyLikelihood": { - "type": "Likelihood", - "id": 9 - }, - "sorrowLikelihood": { - "type": "Likelihood", - "id": 10 - }, - "angerLikelihood": { - "type": "Likelihood", - "id": 11 - }, - "surpriseLikelihood": { - "type": "Likelihood", - "id": 12 - }, - "underExposedLikelihood": { - "type": "Likelihood", - "id": 13 - }, - "blurredLikelihood": { - "type": "Likelihood", - "id": 14 - }, - "headwearLikelihood": { - "type": "Likelihood", - "id": 15 - } - }, - "nested": { - "Landmark": { - "fields": { - "type": { - "type": "Type", - "id": 3 - }, - "position": { - "type": "Position", - "id": 4 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - } - } - }, - "LocationInfo": { - "fields": { - "latLng": { - "type": "google.type.LatLng", - "id": 1 - } - } - }, - "Property": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - }, - "uint64Value": { - "type": "uint64", - "id": 3 - } - } - }, - "EntityAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "locale": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - }, - "topicality": { - "type": "float", - "id": 6 - }, - "boundingPoly": { - "type": "BoundingPoly", - "id": 7 - }, - "locations": { - "rule": "repeated", - "type": "LocationInfo", - "id": 8 - }, - "properties": { - "rule": "repeated", - "type": "Property", - "id": 9 - } - } - }, - "SafeSearchAnnotation": { - "fields": { - "adult": { - "type": "Likelihood", - "id": 1 - }, - "spoof": { - "type": "Likelihood", - "id": 2 - }, - "medical": { - "type": "Likelihood", - "id": 3 - }, - "violence": { - "type": "Likelihood", - "id": 4 - }, - "racy": { - "type": "Likelihood", - "id": 9 - } - } - }, - "LatLongRect": { - "fields": { - "minLatLng": { - "type": "google.type.LatLng", - "id": 1 - }, - "maxLatLng": { - "type": "google.type.LatLng", - "id": 2 - } - } - }, - "ColorInfo": { - "fields": { - "color": { - "type": "google.type.Color", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pixelFraction": { - "type": "float", - "id": 3 - } - } - }, - "DominantColorsAnnotation": { - "fields": { - "colors": { - "rule": "repeated", - "type": "ColorInfo", - "id": 1 - } - } - }, - "ImageProperties": { - "fields": { - "dominantColors": { - "type": "DominantColorsAnnotation", - "id": 1 - } - } - }, - "CropHint": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - }, - "importanceFraction": { - "type": "float", - "id": 3 - } - } - }, - "CropHintsAnnotation": { - "fields": { - "cropHints": { - "rule": "repeated", - "type": "CropHint", - "id": 1 - } - } - }, - "CropHintsParams": { - "fields": { - "aspectRatios": { - "rule": "repeated", - "type": "float", - "id": 1 - } - } - }, - "WebDetectionParams": { - "fields": { - "includeGeoResults": { - "type": "bool", - "id": 2 - } - } - }, - "TextDetectionParams": { - "fields": { - "enableTextDetectionConfidenceScore": { - "type": "bool", - "id": 9 - }, - "advancedOcrOptions": { - "rule": "repeated", - "type": "string", - "id": 11 - } - } - }, - "ImageContext": { - "fields": { - "latLongRect": { - "type": "LatLongRect", - "id": 1 - }, - "languageHints": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "cropHintsParams": { - "type": "CropHintsParams", - "id": 4 - }, - "webDetectionParams": { - "type": "WebDetectionParams", - "id": 6 - }, - "textDetectionParams": { - "type": "TextDetectionParams", - "id": 12 - } - } - }, - "AnnotateImageRequest": { - "fields": { - "image": { - "type": "Image", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - } - } - }, - "AnnotateImageResponse": { - "fields": { - "faceAnnotations": { - "rule": "repeated", - "type": "FaceAnnotation", - "id": 1 - }, - "landmarkAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 2 - }, - "logoAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 3 - }, - "labelAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 4 - }, - "textAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 5 - }, - "fullTextAnnotation": { - "type": "TextAnnotation", - "id": 12 - }, - "safeSearchAnnotation": { - "type": "SafeSearchAnnotation", - "id": 6 - }, - "imagePropertiesAnnotation": { - "type": "ImageProperties", - "id": 8 - }, - "cropHintsAnnotation": { - "type": "CropHintsAnnotation", - "id": 11 - }, - "webDetection": { - "type": "WebDetection", - "id": 13 - }, - "error": { - "type": "google.rpc.Status", - "id": 9 - } - } - }, - "BatchAnnotateImagesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateImageRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "BatchAnnotateImagesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 1 - } - } - }, - "Likelihood": { - "values": { - "UNKNOWN": 0, - "VERY_UNLIKELY": 1, - "UNLIKELY": 2, - "POSSIBLE": 3, - "LIKELY": 4, - "VERY_LIKELY": 5 - } - }, - "TextAnnotation": { - "fields": { - "pages": { - "rule": "repeated", - "type": "Page", - "id": 1 - }, - "text": { - "type": "string", - "id": 2 - } - }, - "nested": { - "DetectedLanguage": { - "fields": { - "languageCode": { - "type": "string", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - } - } - }, - "DetectedBreak": { - "fields": { - "type": { - "type": "BreakType", - "id": 1 - }, - "isPrefix": { - "type": "bool", - "id": 2 - } - }, - "nested": { - "BreakType": { - "values": { - "UNKNOWN": 0, - "SPACE": 1, - "SURE_SPACE": 2, - "EOL_SURE_SPACE": 3, - "HYPHEN": 4, - "LINE_BREAK": 5 - } - } - } - }, - "TextProperty": { - "fields": { - "detectedLanguages": { - "rule": "repeated", - "type": "DetectedLanguage", - "id": 1 - }, - "detectedBreak": { - "type": "DetectedBreak", - "id": 2 - } - } - } - } - }, - "Page": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "width": { - "type": "int32", - "id": 2 - }, - "height": { - "type": "int32", - "id": 3 - }, - "blocks": { - "rule": "repeated", - "type": "Block", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - } - }, - "Block": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "paragraphs": { - "rule": "repeated", - "type": "Paragraph", - "id": 3 - }, - "blockType": { - "type": "BlockType", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - }, - "nested": { - "BlockType": { - "values": { - "UNKNOWN": 0, - "TEXT": 1, - "TABLE": 2, - "PICTURE": 3, - "RULER": 4, - "BARCODE": 5 - } - } - } - }, - "Paragraph": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "words": { - "rule": "repeated", - "type": "Word", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Word": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "symbols": { - "rule": "repeated", - "type": "Symbol", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Symbol": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "text": { - "type": "string", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "WebDetection": { - "fields": { - "webEntities": { - "rule": "repeated", - "type": "WebEntity", - "id": 1 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 2 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 3 - }, - "pagesWithMatchingImages": { - "rule": "repeated", - "type": "WebPage", - "id": 4 - }, - "visuallySimilarImages": { - "rule": "repeated", - "type": "WebImage", - "id": 6 - }, - "bestGuessLabels": { - "rule": "repeated", - "type": "WebLabel", - "id": 8 - } - }, - "nested": { - "WebEntity": { - "fields": { - "entityId": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - } - } - }, - "WebImage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - } - } - }, - "WebPage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pageTitle": { - "type": "string", - "id": 3 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 4 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 5 - } - } - }, - "WebLabel": { - "fields": { - "label": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - } - } - } - } - } - } - }, - "v1p2beta1": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1;vision", - "java_multiple_files": true, - "java_outer_classname": "WebDetectionProto", - "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", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-vision" - }, - "methods": { - "BatchAnnotateImages": { - "requestType": "BatchAnnotateImagesRequest", - "responseType": "BatchAnnotateImagesResponse", - "options": { - "(google.api.http).post": "/v1p2beta1/images:annotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p2beta1/images:annotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests" - } - ] - }, - "AsyncBatchAnnotateFiles": { - "requestType": "AsyncBatchAnnotateFilesRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1p2beta1/files:asyncBatchAnnotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests", - "(google.longrunning.operation_info).response_type": "AsyncBatchAnnotateFilesResponse", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p2beta1/files:asyncBatchAnnotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "AsyncBatchAnnotateFilesResponse", - "metadata_type": "OperationMetadata" - } - } - ] - } - } - }, - "Feature": { - "fields": { - "type": { - "type": "Type", - "id": 1 - }, - "maxResults": { - "type": "int32", - "id": 2 - }, - "model": { - "type": "string", - "id": 3 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - }, - "ImageSource": { - "fields": { - "gcsImageUri": { - "type": "string", - "id": 1 - }, - "imageUri": { - "type": "string", - "id": 2 - } - } - }, - "Image": { - "fields": { - "content": { - "type": "bytes", - "id": 1 - }, - "source": { - "type": "ImageSource", - "id": 2 - } - } - }, - "FaceAnnotation": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "fdBoundingPoly": { - "type": "BoundingPoly", - "id": 2 - }, - "landmarks": { - "rule": "repeated", - "type": "Landmark", - "id": 3 - }, - "rollAngle": { - "type": "float", - "id": 4 - }, - "panAngle": { - "type": "float", - "id": 5 - }, - "tiltAngle": { - "type": "float", - "id": 6 - }, - "detectionConfidence": { - "type": "float", - "id": 7 - }, - "landmarkingConfidence": { - "type": "float", - "id": 8 - }, - "joyLikelihood": { - "type": "Likelihood", - "id": 9 - }, - "sorrowLikelihood": { - "type": "Likelihood", - "id": 10 - }, - "angerLikelihood": { - "type": "Likelihood", - "id": 11 - }, - "surpriseLikelihood": { - "type": "Likelihood", - "id": 12 - }, - "underExposedLikelihood": { - "type": "Likelihood", - "id": 13 - }, - "blurredLikelihood": { - "type": "Likelihood", - "id": 14 - }, - "headwearLikelihood": { - "type": "Likelihood", - "id": 15 - } - }, - "nested": { - "Landmark": { - "fields": { - "type": { - "type": "Type", - "id": 3 - }, - "position": { - "type": "Position", - "id": 4 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - } - } - }, - "LocationInfo": { - "fields": { - "latLng": { - "type": "google.type.LatLng", - "id": 1 - } - } - }, - "Property": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - }, - "uint64Value": { - "type": "uint64", - "id": 3 - } - } - }, - "EntityAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "locale": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - }, - "topicality": { - "type": "float", - "id": 6 - }, - "boundingPoly": { - "type": "BoundingPoly", - "id": 7 - }, - "locations": { - "rule": "repeated", - "type": "LocationInfo", - "id": 8 - }, - "properties": { - "rule": "repeated", - "type": "Property", - "id": 9 - } - } - }, - "SafeSearchAnnotation": { - "fields": { - "adult": { - "type": "Likelihood", - "id": 1 - }, - "spoof": { - "type": "Likelihood", - "id": 2 - }, - "medical": { - "type": "Likelihood", - "id": 3 - }, - "violence": { - "type": "Likelihood", - "id": 4 - }, - "racy": { - "type": "Likelihood", - "id": 9 - } - } - }, - "LatLongRect": { - "fields": { - "minLatLng": { - "type": "google.type.LatLng", - "id": 1 - }, - "maxLatLng": { - "type": "google.type.LatLng", - "id": 2 - } - } - }, - "ColorInfo": { - "fields": { - "color": { - "type": "google.type.Color", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pixelFraction": { - "type": "float", - "id": 3 - } - } - }, - "DominantColorsAnnotation": { - "fields": { - "colors": { - "rule": "repeated", - "type": "ColorInfo", - "id": 1 - } - } - }, - "ImageProperties": { - "fields": { - "dominantColors": { - "type": "DominantColorsAnnotation", - "id": 1 - } - } - }, - "CropHint": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - }, - "importanceFraction": { - "type": "float", - "id": 3 - } - } - }, - "CropHintsAnnotation": { - "fields": { - "cropHints": { - "rule": "repeated", - "type": "CropHint", - "id": 1 - } - } - }, - "CropHintsParams": { - "fields": { - "aspectRatios": { - "rule": "repeated", - "type": "float", - "id": 1 - } - } - }, - "WebDetectionParams": { - "fields": { - "includeGeoResults": { - "type": "bool", - "id": 2 - } - } - }, - "TextDetectionParams": { - "fields": { - "enableTextDetectionConfidenceScore": { - "type": "bool", - "id": 9 - }, - "advancedOcrOptions": { - "rule": "repeated", - "type": "string", - "id": 11 - } - } - }, - "ImageContext": { - "fields": { - "latLongRect": { - "type": "LatLongRect", - "id": 1 - }, - "languageHints": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "cropHintsParams": { - "type": "CropHintsParams", - "id": 4 - }, - "webDetectionParams": { - "type": "WebDetectionParams", - "id": 6 - }, - "textDetectionParams": { - "type": "TextDetectionParams", - "id": 12 - } - } - }, - "AnnotateImageRequest": { - "fields": { - "image": { - "type": "Image", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - } - } - }, - "ImageAnnotationContext": { - "fields": { - "uri": { - "type": "string", - "id": 1 - }, - "pageNumber": { - "type": "int32", - "id": 2 - } - } - }, - "AnnotateImageResponse": { - "fields": { - "faceAnnotations": { - "rule": "repeated", - "type": "FaceAnnotation", - "id": 1 - }, - "landmarkAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 2 - }, - "logoAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 3 - }, - "labelAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 4 - }, - "textAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 5 - }, - "fullTextAnnotation": { - "type": "TextAnnotation", - "id": 12 - }, - "safeSearchAnnotation": { - "type": "SafeSearchAnnotation", - "id": 6 - }, - "imagePropertiesAnnotation": { - "type": "ImageProperties", - "id": 8 - }, - "cropHintsAnnotation": { - "type": "CropHintsAnnotation", - "id": 11 - }, - "webDetection": { - "type": "WebDetection", - "id": 13 - }, - "error": { - "type": "google.rpc.Status", - "id": 9 - }, - "context": { - "type": "ImageAnnotationContext", - "id": 21 - } - } - }, - "AnnotateFileResponse": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 2 - } - } - }, - "BatchAnnotateImagesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateImageRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "BatchAnnotateImagesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 1 - } - } - }, - "AsyncAnnotateFileRequest": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - }, - "outputConfig": { - "type": "OutputConfig", - "id": 4 - } - } - }, - "AsyncAnnotateFileResponse": { - "fields": { - "outputConfig": { - "type": "OutputConfig", - "id": 1 - } - } - }, - "AsyncBatchAnnotateFilesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AsyncAnnotateFileRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "AsyncBatchAnnotateFilesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AsyncAnnotateFileResponse", - "id": 1 - } - } - }, - "InputConfig": { - "fields": { - "gcsSource": { - "type": "GcsSource", - "id": 1 - }, - "mimeType": { - "type": "string", - "id": 2 - } - } - }, - "OutputConfig": { - "fields": { - "gcsDestination": { - "type": "GcsDestination", - "id": 1 - }, - "batchSize": { - "type": "int32", - "id": 2 - } - } - }, - "GcsSource": { - "fields": { - "uri": { - "type": "string", - "id": 1 - } - } - }, - "GcsDestination": { - "fields": { - "uri": { - "type": "string", - "id": 1 - } - } - }, - "OperationMetadata": { - "fields": { - "state": { - "type": "State", - "id": 1 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "CREATED": 1, - "RUNNING": 2, - "DONE": 3, - "CANCELLED": 4 - } - } - } - }, - "Likelihood": { - "values": { - "UNKNOWN": 0, - "VERY_UNLIKELY": 1, - "UNLIKELY": 2, - "POSSIBLE": 3, - "LIKELY": 4, - "VERY_LIKELY": 5 - } - }, - "TextAnnotation": { - "fields": { - "pages": { - "rule": "repeated", - "type": "Page", - "id": 1 - }, - "text": { - "type": "string", - "id": 2 - } - }, - "nested": { - "DetectedLanguage": { - "fields": { - "languageCode": { - "type": "string", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - } - } - }, - "DetectedBreak": { - "fields": { - "type": { - "type": "BreakType", - "id": 1 - }, - "isPrefix": { - "type": "bool", - "id": 2 - } - }, - "nested": { - "BreakType": { - "values": { - "UNKNOWN": 0, - "SPACE": 1, - "SURE_SPACE": 2, - "EOL_SURE_SPACE": 3, - "HYPHEN": 4, - "LINE_BREAK": 5 - } - } - } - }, - "TextProperty": { - "fields": { - "detectedLanguages": { - "rule": "repeated", - "type": "DetectedLanguage", - "id": 1 - }, - "detectedBreak": { - "type": "DetectedBreak", - "id": 2 - } - } - } - } - }, - "Page": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "width": { - "type": "int32", - "id": 2 - }, - "height": { - "type": "int32", - "id": 3 - }, - "blocks": { - "rule": "repeated", - "type": "Block", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - } - }, - "Block": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "paragraphs": { - "rule": "repeated", - "type": "Paragraph", - "id": 3 - }, - "blockType": { - "type": "BlockType", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - }, - "nested": { - "BlockType": { - "values": { - "UNKNOWN": 0, - "TEXT": 1, - "TABLE": 2, - "PICTURE": 3, - "RULER": 4, - "BARCODE": 5 - } - } - } - }, - "Paragraph": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "words": { - "rule": "repeated", - "type": "Word", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Word": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "symbols": { - "rule": "repeated", - "type": "Symbol", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Symbol": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "text": { - "type": "string", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "WebDetection": { - "fields": { - "webEntities": { - "rule": "repeated", - "type": "WebEntity", - "id": 1 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 2 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 3 - }, - "pagesWithMatchingImages": { - "rule": "repeated", - "type": "WebPage", - "id": 4 - }, - "visuallySimilarImages": { - "rule": "repeated", - "type": "WebImage", - "id": 6 - }, - "bestGuessLabels": { - "rule": "repeated", - "type": "WebLabel", - "id": 8 - } - }, - "nested": { - "WebEntity": { - "fields": { - "entityId": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - } - } - }, - "WebImage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - } - } - }, - "WebPage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pageTitle": { - "type": "string", - "id": 3 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 4 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 5 - } - } - }, - "WebLabel": { - "fields": { - "label": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - } - } - } - } - } - } - }, - "v1p3beta1": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1;vision", - "java_multiple_files": true, - "java_outer_classname": "WebDetectionProto", - "java_package": "com.google.cloud.vision.v1p3beta1", - "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", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-vision" - }, - "methods": { - "BatchAnnotateImages": { - "requestType": "BatchAnnotateImagesRequest", - "responseType": "BatchAnnotateImagesResponse", - "options": { - "(google.api.http).post": "/v1p3beta1/images:annotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p3beta1/images:annotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests" - } - ] - }, - "AsyncBatchAnnotateFiles": { - "requestType": "AsyncBatchAnnotateFilesRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1p3beta1/files:asyncBatchAnnotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests", - "(google.longrunning.operation_info).response_type": "AsyncBatchAnnotateFilesResponse", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p3beta1/files:asyncBatchAnnotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "AsyncBatchAnnotateFilesResponse", - "metadata_type": "OperationMetadata" - } - } - ] - } - } - }, - "Feature": { - "fields": { - "type": { - "type": "Type", - "id": 1 - }, - "maxResults": { - "type": "int32", - "id": 2 - }, - "model": { - "type": "string", - "id": 3 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - }, - "ImageSource": { - "fields": { - "gcsImageUri": { - "type": "string", - "id": 1 - }, - "imageUri": { - "type": "string", - "id": 2 - } - } - }, - "Image": { - "fields": { - "content": { - "type": "bytes", - "id": 1 - }, - "source": { - "type": "ImageSource", - "id": 2 - } - } - }, - "FaceAnnotation": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "fdBoundingPoly": { - "type": "BoundingPoly", - "id": 2 - }, - "landmarks": { - "rule": "repeated", - "type": "Landmark", - "id": 3 - }, - "rollAngle": { - "type": "float", - "id": 4 - }, - "panAngle": { - "type": "float", - "id": 5 - }, - "tiltAngle": { - "type": "float", - "id": 6 - }, - "detectionConfidence": { - "type": "float", - "id": 7 - }, - "landmarkingConfidence": { - "type": "float", - "id": 8 - }, - "joyLikelihood": { - "type": "Likelihood", - "id": 9 - }, - "sorrowLikelihood": { - "type": "Likelihood", - "id": 10 - }, - "angerLikelihood": { - "type": "Likelihood", - "id": 11 - }, - "surpriseLikelihood": { - "type": "Likelihood", - "id": 12 - }, - "underExposedLikelihood": { - "type": "Likelihood", - "id": 13 - }, - "blurredLikelihood": { - "type": "Likelihood", - "id": 14 - }, - "headwearLikelihood": { - "type": "Likelihood", - "id": 15 - } - }, - "nested": { - "Landmark": { - "fields": { - "type": { - "type": "Type", - "id": 3 - }, - "position": { - "type": "Position", - "id": 4 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - } - } - }, - "LocationInfo": { - "fields": { - "latLng": { - "type": "google.type.LatLng", - "id": 1 - } - } - }, - "Property": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - }, - "uint64Value": { - "type": "uint64", - "id": 3 - } - } - }, - "EntityAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "locale": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - }, - "topicality": { - "type": "float", - "id": 6 - }, - "boundingPoly": { - "type": "BoundingPoly", - "id": 7 - }, - "locations": { - "rule": "repeated", - "type": "LocationInfo", - "id": 8 - }, - "properties": { - "rule": "repeated", - "type": "Property", - "id": 9 - } - } - }, - "LocalizedObjectAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - }, - "boundingPoly": { - "type": "BoundingPoly", - "id": 5 - } - } - }, - "SafeSearchAnnotation": { - "fields": { - "adult": { - "type": "Likelihood", - "id": 1 - }, - "spoof": { - "type": "Likelihood", - "id": 2 - }, - "medical": { - "type": "Likelihood", - "id": 3 - }, - "violence": { - "type": "Likelihood", - "id": 4 - }, - "racy": { - "type": "Likelihood", - "id": 9 - } - } - }, - "LatLongRect": { - "fields": { - "minLatLng": { - "type": "google.type.LatLng", - "id": 1 - }, - "maxLatLng": { - "type": "google.type.LatLng", - "id": 2 - } - } - }, - "ColorInfo": { - "fields": { - "color": { - "type": "google.type.Color", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pixelFraction": { - "type": "float", - "id": 3 - } - } - }, - "DominantColorsAnnotation": { - "fields": { - "colors": { - "rule": "repeated", - "type": "ColorInfo", - "id": 1 - } - } - }, - "ImageProperties": { - "fields": { - "dominantColors": { - "type": "DominantColorsAnnotation", - "id": 1 - } - } - }, - "CropHint": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - }, - "importanceFraction": { - "type": "float", - "id": 3 - } - } - }, - "CropHintsAnnotation": { - "fields": { - "cropHints": { - "rule": "repeated", - "type": "CropHint", - "id": 1 - } - } - }, - "CropHintsParams": { - "fields": { - "aspectRatios": { - "rule": "repeated", - "type": "float", - "id": 1 - } - } - }, - "WebDetectionParams": { - "fields": { - "includeGeoResults": { - "type": "bool", - "id": 2 - } - } - }, - "TextDetectionParams": { - "fields": { - "enableTextDetectionConfidenceScore": { - "type": "bool", - "id": 9 - }, - "advancedOcrOptions": { - "rule": "repeated", - "type": "string", - "id": 11 - } - } - }, - "ImageContext": { - "fields": { - "latLongRect": { - "type": "LatLongRect", - "id": 1 - }, - "languageHints": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "cropHintsParams": { - "type": "CropHintsParams", - "id": 4 - }, - "productSearchParams": { - "type": "google.cloud.vision.v1p3beta1.ProductSearchParams", - "id": 5 - }, - "webDetectionParams": { - "type": "WebDetectionParams", - "id": 6 - }, - "textDetectionParams": { - "type": "TextDetectionParams", - "id": 12 - } - } - }, - "AnnotateImageRequest": { - "fields": { - "image": { - "type": "Image", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - } - } - }, - "ImageAnnotationContext": { - "fields": { - "uri": { - "type": "string", - "id": 1 - }, - "pageNumber": { - "type": "int32", - "id": 2 - } - } - }, - "AnnotateImageResponse": { - "fields": { - "faceAnnotations": { - "rule": "repeated", - "type": "FaceAnnotation", - "id": 1 - }, - "landmarkAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 2 - }, - "logoAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 3 - }, - "labelAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 4 - }, - "localizedObjectAnnotations": { - "rule": "repeated", - "type": "LocalizedObjectAnnotation", - "id": 22 - }, - "textAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 5 - }, - "fullTextAnnotation": { - "type": "TextAnnotation", - "id": 12 - }, - "safeSearchAnnotation": { - "type": "SafeSearchAnnotation", - "id": 6 - }, - "imagePropertiesAnnotation": { - "type": "ImageProperties", - "id": 8 - }, - "cropHintsAnnotation": { - "type": "CropHintsAnnotation", - "id": 11 - }, - "webDetection": { - "type": "WebDetection", - "id": 13 - }, - "productSearchResults": { - "type": "google.cloud.vision.v1p3beta1.ProductSearchResults", - "id": 14 - }, - "error": { - "type": "google.rpc.Status", - "id": 9 - }, - "context": { - "type": "ImageAnnotationContext", - "id": 21 - } - } - }, - "AnnotateFileResponse": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 2 - } - } - }, - "BatchAnnotateImagesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateImageRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "BatchAnnotateImagesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 1 - } - } - }, - "AsyncAnnotateFileRequest": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - }, - "outputConfig": { - "type": "OutputConfig", - "id": 4 - } - } - }, - "AsyncAnnotateFileResponse": { - "fields": { - "outputConfig": { - "type": "OutputConfig", - "id": 1 - } - } - }, - "AsyncBatchAnnotateFilesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AsyncAnnotateFileRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "AsyncBatchAnnotateFilesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AsyncAnnotateFileResponse", - "id": 1 - } - } - }, - "InputConfig": { - "fields": { - "gcsSource": { - "type": "GcsSource", - "id": 1 - }, - "mimeType": { - "type": "string", - "id": 2 - } - } - }, - "OutputConfig": { - "fields": { - "gcsDestination": { - "type": "GcsDestination", - "id": 1 - }, - "batchSize": { - "type": "int32", - "id": 2 - } - } - }, - "GcsSource": { - "fields": { - "uri": { - "type": "string", - "id": 1 - } - } - }, - "GcsDestination": { - "fields": { - "uri": { - "type": "string", - "id": 1 - } - } - }, - "Likelihood": { - "values": { - "UNKNOWN": 0, - "VERY_UNLIKELY": 1, - "UNLIKELY": 2, - "POSSIBLE": 3, - "LIKELY": 4, - "VERY_LIKELY": 5 - } - }, - "OperationMetadata": { - "fields": { - "state": { - "type": "State", - "id": 1 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "CREATED": 1, - "RUNNING": 2, - "DONE": 3, - "CANCELLED": 4 - } - } - } - }, - "ProductSearchParams": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 9 - }, - "productSet": { - "type": "string", - "id": 6, - "options": { - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "productCategories": { - "rule": "repeated", - "type": "string", - "id": 7 - }, - "filter": { - "type": "string", - "id": 8 - } - } - }, - "ProductSearchResults": { - "fields": { - "indexTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "results": { - "rule": "repeated", - "type": "Result", - "id": 5 - }, - "productGroupedResults": { - "rule": "repeated", - "type": "GroupedResult", - "id": 6 - } - }, - "nested": { - "Result": { - "fields": { - "product": { - "type": "Product", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "image": { - "type": "string", - "id": 3 - } - } - }, - "ObjectAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - } - } - }, - "GroupedResult": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "results": { - "rule": "repeated", - "type": "Result", - "id": 2 - }, - "objectAnnotations": { - "rule": "repeated", - "type": "ObjectAnnotation", - "id": 3 - } - } - } - } - }, - "ProductSearch": { - "options": { - "(google.api.default_host)": "vision.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-vision" - }, - "methods": { - "CreateProductSet": { - "requestType": "CreateProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).post": "/v1p3beta1/{parent=projects/*/locations/*}/productSets", - "(google.api.http).body": "product_set", - "(google.api.method_signature)": "parent,product_set,product_set_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p3beta1/{parent=projects/*/locations/*}/productSets", - "body": "product_set" - } - }, - { - "(google.api.method_signature)": "parent,product_set,product_set_id" - } - ] - }, - "ListProductSets": { - "requestType": "ListProductSetsRequest", - "responseType": "ListProductSetsResponse", - "options": { - "(google.api.http).get": "/v1p3beta1/{parent=projects/*/locations/*}/productSets", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p3beta1/{parent=projects/*/locations/*}/productSets" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetProductSet": { - "requestType": "GetProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).get": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "UpdateProductSet": { - "requestType": "UpdateProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).patch": "/v1p3beta1/{product_set.name=projects/*/locations/*/productSets/*}", - "(google.api.http).body": "product_set", - "(google.api.method_signature)": "product_set,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1p3beta1/{product_set.name=projects/*/locations/*/productSets/*}", - "body": "product_set" - } - }, - { - "(google.api.method_signature)": "product_set,update_mask" - } - ] - }, - "DeleteProductSet": { - "requestType": "DeleteProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).post": "/v1p3beta1/{parent=projects/*/locations/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p3beta1/{parent=projects/*/locations/*}/products", - "body": "product" - } - }, - { - "(google.api.method_signature)": "parent,product,product_id" - } - ] - }, - "ListProducts": { - "requestType": "ListProductsRequest", - "responseType": "ListProductsResponse", - "options": { - "(google.api.http).get": "/v1p3beta1/{parent=projects/*/locations/*}/products", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p3beta1/{parent=projects/*/locations/*}/products" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetProduct": { - "requestType": "GetProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).get": "/v1p3beta1/{name=projects/*/locations/*/products/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p3beta1/{name=projects/*/locations/*/products/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "UpdateProduct": { - "requestType": "UpdateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).patch": "/v1p3beta1/{product.name=projects/*/locations/*/products/*}", - "(google.api.http).body": "product", - "(google.api.method_signature)": "product,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1p3beta1/{product.name=projects/*/locations/*/products/*}", - "body": "product" - } - }, - { - "(google.api.method_signature)": "product,update_mask" - } - ] - }, - "DeleteProduct": { - "requestType": "DeleteProductRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1p3beta1/{name=projects/*/locations/*/products/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1p3beta1/{name=projects/*/locations/*/products/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CreateReferenceImage": { - "requestType": "CreateReferenceImageRequest", - "responseType": "ReferenceImage", - "options": { - "(google.api.http).post": "/v1p3beta1/{parent=projects/*/locations/*/products/*}/referenceImages", - "(google.api.http).body": "reference_image", - "(google.api.method_signature)": "parent,reference_image,reference_image_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p3beta1/{parent=projects/*/locations/*/products/*}/referenceImages", - "body": "reference_image" - } - }, - { - "(google.api.method_signature)": "parent,reference_image,reference_image_id" - } - ] - }, - "DeleteReferenceImage": { - "requestType": "DeleteReferenceImageRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1p3beta1/{name=projects/*/locations/*/products/*/referenceImages/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1p3beta1/{name=projects/*/locations/*/products/*/referenceImages/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ListReferenceImages": { - "requestType": "ListReferenceImagesRequest", - "responseType": "ListReferenceImagesResponse", - "options": { - "(google.api.http).get": "/v1p3beta1/{parent=projects/*/locations/*/products/*}/referenceImages", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p3beta1/{parent=projects/*/locations/*/products/*}/referenceImages" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetReferenceImage": { - "requestType": "GetReferenceImageRequest", - "responseType": "ReferenceImage", - "options": { - "(google.api.http).get": "/v1p3beta1/{name=projects/*/locations/*/products/*/referenceImages/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p3beta1/{name=projects/*/locations/*/products/*/referenceImages/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "AddProductToProductSet": { - "requestType": "AddProductToProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}:addProduct", - "(google.api.http).body": "*", - "(google.api.method_signature)": "name,product" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}:addProduct", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name,product" - } - ] - }, - "RemoveProductFromProductSet": { - "requestType": "RemoveProductFromProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}:removeProduct", - "(google.api.http).body": "*", - "(google.api.method_signature)": "name,product" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}:removeProduct", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name,product" - } - ] - }, - "ListProductsInProductSet": { - "requestType": "ListProductsInProductSetRequest", - "responseType": "ListProductsInProductSetResponse", - "options": { - "(google.api.http).get": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}/products", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p3beta1/{name=projects/*/locations/*/productSets/*}/products" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ImportProductSets": { - "requestType": "ImportProductSetsRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1p3beta1/{parent=projects/*/locations/*}/productSets:import", - "(google.api.http).body": "*", - "(google.api.method_signature)": "parent,input_config", - "(google.longrunning.operation_info).response_type": "ImportProductSetsResponse", - "(google.longrunning.operation_info).metadata_type": "BatchOperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p3beta1/{parent=projects/*/locations/*}/productSets:import", - "body": "*" - } - }, - { - "(google.api.method_signature)": "parent,input_config" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "ImportProductSetsResponse", - "metadata_type": "BatchOperationMetadata" - } - } - ] - } - } - }, - "Product": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/Product", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/products/{product}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "displayName": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "productCategory": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "IMMUTABLE" - } - }, - "productLabels": { - "rule": "repeated", - "type": "KeyValue", - "id": 5 - } - }, - "nested": { - "KeyValue": { - "fields": { - "key": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - } - } - } - } - }, - "ProductSet": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/ProductSet", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/productSets/{product_set}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "displayName": { - "type": "string", - "id": 2 - }, - "indexTime": { - "type": "google.protobuf.Timestamp", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "indexError": { - "type": "google.rpc.Status", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "ReferenceImage": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/ReferenceImage", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "uri": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "boundingPolys": { - "rule": "repeated", - "type": "BoundingPoly", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "CreateProductRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "product": { - "type": "Product", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "productId": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsResponse": { - "fields": { - "products": { - "rule": "repeated", - "type": "Product", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetProductRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "UpdateProductRequest": { - "fields": { - "product": { - "type": "Product", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "DeleteProductRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "CreateProductSetRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "productSet": { - "type": "ProductSet", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "productSetId": { - "type": "string", - "id": 3 - } - } - }, - "ListProductSetsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductSetsResponse": { - "fields": { - "productSets": { - "rule": "repeated", - "type": "ProductSet", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - } - } - }, - "UpdateProductSetRequest": { - "fields": { - "productSet": { - "type": "ProductSet", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "DeleteProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - } - } - }, - "CreateReferenceImageRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - }, - "referenceImage": { - "type": "ReferenceImage", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "referenceImageId": { - "type": "string", - "id": 3 - } - } - }, - "ListReferenceImagesRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListReferenceImagesResponse": { - "fields": { - "referenceImages": { - "rule": "repeated", - "type": "ReferenceImage", - "id": 1 - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3 - } - } - }, - "GetReferenceImageRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ReferenceImage" - } - } - } - }, - "DeleteReferenceImageRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ReferenceImage" - } - } - } - }, - "AddProductToProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "product": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "RemoveProductFromProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "product": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "ListProductsInProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsInProductSetResponse": { - "fields": { - "products": { - "rule": "repeated", - "type": "Product", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "ImportProductSetsGcsSource": { - "fields": { - "csvFileUri": { - "type": "string", - "id": 1 - } - } - }, - "ImportProductSetsInputConfig": { - "oneofs": { - "source": { - "oneof": [ - "gcsSource" - ] - } - }, - "fields": { - "gcsSource": { - "type": "ImportProductSetsGcsSource", - "id": 1 - } - } - }, - "ImportProductSetsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "inputConfig": { - "type": "ImportProductSetsInputConfig", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "ImportProductSetsResponse": { - "fields": { - "referenceImages": { - "rule": "repeated", - "type": "ReferenceImage", - "id": 1 - }, - "statuses": { - "rule": "repeated", - "type": "google.rpc.Status", - "id": 2 - } - } - }, - "BatchOperationMetadata": { - "fields": { - "state": { - "type": "State", - "id": 1 - }, - "submitTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "PROCESSING": 1, - "SUCCESSFUL": 2, - "FAILED": 3, - "CANCELLED": 4 - } - } - } - }, - "TextAnnotation": { - "fields": { - "pages": { - "rule": "repeated", - "type": "Page", - "id": 1 - }, - "text": { - "type": "string", - "id": 2 - } - }, - "nested": { - "DetectedLanguage": { - "fields": { - "languageCode": { - "type": "string", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - } - } - }, - "DetectedBreak": { - "fields": { - "type": { - "type": "BreakType", - "id": 1 - }, - "isPrefix": { - "type": "bool", - "id": 2 - } - }, - "nested": { - "BreakType": { - "values": { - "UNKNOWN": 0, - "SPACE": 1, - "SURE_SPACE": 2, - "EOL_SURE_SPACE": 3, - "HYPHEN": 4, - "LINE_BREAK": 5 - } - } - } - }, - "TextProperty": { - "fields": { - "detectedLanguages": { - "rule": "repeated", - "type": "DetectedLanguage", - "id": 1 - }, - "detectedBreak": { - "type": "DetectedBreak", - "id": 2 - } - } - } - } - }, - "Page": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "width": { - "type": "int32", - "id": 2 - }, - "height": { - "type": "int32", - "id": 3 - }, - "blocks": { - "rule": "repeated", - "type": "Block", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - } - }, - "Block": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "paragraphs": { - "rule": "repeated", - "type": "Paragraph", - "id": 3 - }, - "blockType": { - "type": "BlockType", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - }, - "nested": { - "BlockType": { - "values": { - "UNKNOWN": 0, - "TEXT": 1, - "TABLE": 2, - "PICTURE": 3, - "RULER": 4, - "BARCODE": 5 - } - } - } - }, - "Paragraph": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "words": { - "rule": "repeated", - "type": "Word", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Word": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "symbols": { - "rule": "repeated", - "type": "Symbol", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Symbol": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "text": { - "type": "string", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "WebDetection": { - "fields": { - "webEntities": { - "rule": "repeated", - "type": "WebEntity", - "id": 1 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 2 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 3 - }, - "pagesWithMatchingImages": { - "rule": "repeated", - "type": "WebPage", - "id": 4 - }, - "visuallySimilarImages": { - "rule": "repeated", - "type": "WebImage", - "id": 6 - }, - "bestGuessLabels": { - "rule": "repeated", - "type": "WebLabel", - "id": 8 - } - }, - "nested": { - "WebEntity": { - "fields": { - "entityId": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - } - } - }, - "WebImage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - } - } - }, - "WebPage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pageTitle": { - "type": "string", - "id": 3 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 4 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 5 - } - } - }, - "WebLabel": { - "fields": { - "label": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - } - } - } - } - } - } - }, - "v1p4beta1": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1;vision", - "java_multiple_files": true, - "java_outer_classname": "WebDetectionProto", - "java_package": "com.google.cloud.vision.v1p4beta1", - "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", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-vision" - }, - "methods": { - "BatchAnnotateImages": { - "requestType": "BatchAnnotateImagesRequest", - "responseType": "BatchAnnotateImagesResponse", - "options": { - "(google.api.http).post": "/v1p4beta1/images:annotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/images:annotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests" - } - ] - }, - "BatchAnnotateFiles": { - "requestType": "BatchAnnotateFilesRequest", - "responseType": "BatchAnnotateFilesResponse", - "options": { - "(google.api.http).post": "/v1p4beta1/files:annotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/files:annotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests" - } - ] - }, - "AsyncBatchAnnotateImages": { - "requestType": "AsyncBatchAnnotateImagesRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1p4beta1/images:asyncBatchAnnotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests,output_config", - "(google.longrunning.operation_info).response_type": "AsyncBatchAnnotateImagesResponse", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/images:asyncBatchAnnotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests,output_config" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "AsyncBatchAnnotateImagesResponse", - "metadata_type": "OperationMetadata" - } - } - ] - }, - "AsyncBatchAnnotateFiles": { - "requestType": "AsyncBatchAnnotateFilesRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1p4beta1/files:asyncBatchAnnotate", - "(google.api.http).body": "*", - "(google.api.method_signature)": "requests", - "(google.longrunning.operation_info).response_type": "AsyncBatchAnnotateFilesResponse", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/files:asyncBatchAnnotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "requests" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "AsyncBatchAnnotateFilesResponse", - "metadata_type": "OperationMetadata" - } - } - ] - } - } - }, - "Feature": { - "fields": { - "type": { - "type": "Type", - "id": 1 - }, - "maxResults": { - "type": "int32", - "id": 2 - }, - "model": { - "type": "string", - "id": 3 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - }, - "ImageSource": { - "fields": { - "gcsImageUri": { - "type": "string", - "id": 1 - }, - "imageUri": { - "type": "string", - "id": 2 - } - } - }, - "Image": { - "fields": { - "content": { - "type": "bytes", - "id": 1 - }, - "source": { - "type": "ImageSource", - "id": 2 - } - } - }, - "Likelihood": { - "values": { - "UNKNOWN": 0, - "VERY_UNLIKELY": 1, - "UNLIKELY": 2, - "POSSIBLE": 3, - "LIKELY": 4, - "VERY_LIKELY": 5 - } - }, - "FaceAnnotation": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "fdBoundingPoly": { - "type": "BoundingPoly", - "id": 2 - }, - "landmarks": { - "rule": "repeated", - "type": "Landmark", - "id": 3 - }, - "rollAngle": { - "type": "float", - "id": 4 - }, - "panAngle": { - "type": "float", - "id": 5 - }, - "tiltAngle": { - "type": "float", - "id": 6 - }, - "detectionConfidence": { - "type": "float", - "id": 7 - }, - "landmarkingConfidence": { - "type": "float", - "id": 8 - }, - "joyLikelihood": { - "type": "Likelihood", - "id": 9 - }, - "sorrowLikelihood": { - "type": "Likelihood", - "id": 10 - }, - "angerLikelihood": { - "type": "Likelihood", - "id": 11 - }, - "surpriseLikelihood": { - "type": "Likelihood", - "id": 12 - }, - "underExposedLikelihood": { - "type": "Likelihood", - "id": 13 - }, - "blurredLikelihood": { - "type": "Likelihood", - "id": 14 - }, - "headwearLikelihood": { - "type": "Likelihood", - "id": 15 - }, - "recognitionResult": { - "rule": "repeated", - "type": "FaceRecognitionResult", - "id": 16 - } - }, - "nested": { - "Landmark": { - "fields": { - "type": { - "type": "Type", - "id": 3 - }, - "position": { - "type": "Position", - "id": 4 - } - }, - "nested": { - "Type": { - "values": { - "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 - } - } - } - } - } - }, - "LocationInfo": { - "fields": { - "latLng": { - "type": "google.type.LatLng", - "id": 1 - } - } - }, - "Property": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - }, - "uint64Value": { - "type": "uint64", - "id": 3 - } - } - }, - "EntityAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "locale": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5, - "options": { - "deprecated": true - } - }, - "topicality": { - "type": "float", - "id": 6 - }, - "boundingPoly": { - "type": "BoundingPoly", - "id": 7 - }, - "locations": { - "rule": "repeated", - "type": "LocationInfo", - "id": 8 - }, - "properties": { - "rule": "repeated", - "type": "Property", - "id": 9 - } - } - }, - "LocalizedObjectAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - }, - "boundingPoly": { - "type": "BoundingPoly", - "id": 5 - } - } - }, - "SafeSearchAnnotation": { - "fields": { - "adult": { - "type": "Likelihood", - "id": 1 - }, - "spoof": { - "type": "Likelihood", - "id": 2 - }, - "medical": { - "type": "Likelihood", - "id": 3 - }, - "violence": { - "type": "Likelihood", - "id": 4 - }, - "racy": { - "type": "Likelihood", - "id": 9 - } - } - }, - "LatLongRect": { - "fields": { - "minLatLng": { - "type": "google.type.LatLng", - "id": 1 - }, - "maxLatLng": { - "type": "google.type.LatLng", - "id": 2 - } - } - }, - "ColorInfo": { - "fields": { - "color": { - "type": "google.type.Color", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pixelFraction": { - "type": "float", - "id": 3 - } - } - }, - "DominantColorsAnnotation": { - "fields": { - "colors": { - "rule": "repeated", - "type": "ColorInfo", - "id": 1 - } - } - }, - "ImageProperties": { - "fields": { - "dominantColors": { - "type": "DominantColorsAnnotation", - "id": 1 - } - } - }, - "CropHint": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - }, - "importanceFraction": { - "type": "float", - "id": 3 - } - } - }, - "CropHintsAnnotation": { - "fields": { - "cropHints": { - "rule": "repeated", - "type": "CropHint", - "id": 1 - } - } - }, - "CropHintsParams": { - "fields": { - "aspectRatios": { - "rule": "repeated", - "type": "float", - "id": 1 - } - } - }, - "WebDetectionParams": { - "fields": { - "includeGeoResults": { - "type": "bool", - "id": 2 - } - } - }, - "TextDetectionParams": { - "fields": { - "enableTextDetectionConfidenceScore": { - "type": "bool", - "id": 9 - }, - "advancedOcrOptions": { - "rule": "repeated", - "type": "string", - "id": 11 - } - } - }, - "ImageContext": { - "fields": { - "latLongRect": { - "type": "LatLongRect", - "id": 1 - }, - "languageHints": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "cropHintsParams": { - "type": "CropHintsParams", - "id": 4 - }, - "faceRecognitionParams": { - "type": "FaceRecognitionParams", - "id": 10 - }, - "productSearchParams": { - "type": "ProductSearchParams", - "id": 5 - }, - "webDetectionParams": { - "type": "WebDetectionParams", - "id": 6 - }, - "textDetectionParams": { - "type": "TextDetectionParams", - "id": 12 - } - } - }, - "AnnotateImageRequest": { - "fields": { - "image": { - "type": "Image", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - } - } - }, - "ImageAnnotationContext": { - "fields": { - "uri": { - "type": "string", - "id": 1 - }, - "pageNumber": { - "type": "int32", - "id": 2 - } - } - }, - "AnnotateImageResponse": { - "fields": { - "faceAnnotations": { - "rule": "repeated", - "type": "FaceAnnotation", - "id": 1 - }, - "landmarkAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 2 - }, - "logoAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 3 - }, - "labelAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 4 - }, - "localizedObjectAnnotations": { - "rule": "repeated", - "type": "LocalizedObjectAnnotation", - "id": 22 - }, - "textAnnotations": { - "rule": "repeated", - "type": "EntityAnnotation", - "id": 5 - }, - "fullTextAnnotation": { - "type": "TextAnnotation", - "id": 12 - }, - "safeSearchAnnotation": { - "type": "SafeSearchAnnotation", - "id": 6 - }, - "imagePropertiesAnnotation": { - "type": "ImageProperties", - "id": 8 - }, - "cropHintsAnnotation": { - "type": "CropHintsAnnotation", - "id": 11 - }, - "webDetection": { - "type": "WebDetection", - "id": 13 - }, - "productSearchResults": { - "type": "ProductSearchResults", - "id": 14 - }, - "error": { - "type": "google.rpc.Status", - "id": 9 - }, - "context": { - "type": "ImageAnnotationContext", - "id": 21 - } - } - }, - "BatchAnnotateImagesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateImageRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "BatchAnnotateImagesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 1 - } - } - }, - "AnnotateFileRequest": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - }, - "pages": { - "rule": "repeated", - "type": "int32", - "id": 4 - } - } - }, - "AnnotateFileResponse": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "responses": { - "rule": "repeated", - "type": "AnnotateImageResponse", - "id": 2 - }, - "totalPages": { - "type": "int32", - "id": 3 - }, - "error": { - "type": "google.rpc.Status", - "id": 4 - } - } - }, - "BatchAnnotateFilesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateFileRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "BatchAnnotateFilesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AnnotateFileResponse", - "id": 1 - } - } - }, - "AsyncAnnotateFileRequest": { - "fields": { - "inputConfig": { - "type": "InputConfig", - "id": 1 - }, - "features": { - "rule": "repeated", - "type": "Feature", - "id": 2 - }, - "imageContext": { - "type": "ImageContext", - "id": 3 - }, - "outputConfig": { - "type": "OutputConfig", - "id": 4 - } - } - }, - "AsyncAnnotateFileResponse": { - "fields": { - "outputConfig": { - "type": "OutputConfig", - "id": 1 - } - } - }, - "AsyncBatchAnnotateImagesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AnnotateImageRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "outputConfig": { - "type": "OutputConfig", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "AsyncBatchAnnotateImagesResponse": { - "fields": { - "outputConfig": { - "type": "OutputConfig", - "id": 1 - } - } - }, - "AsyncBatchAnnotateFilesRequest": { - "fields": { - "requests": { - "rule": "repeated", - "type": "AsyncAnnotateFileRequest", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "AsyncBatchAnnotateFilesResponse": { - "fields": { - "responses": { - "rule": "repeated", - "type": "AsyncAnnotateFileResponse", - "id": 1 - } - } - }, - "InputConfig": { - "fields": { - "gcsSource": { - "type": "GcsSource", - "id": 1 - }, - "content": { - "type": "bytes", - "id": 3 - }, - "mimeType": { - "type": "string", - "id": 2 - } - } - }, - "OutputConfig": { - "fields": { - "gcsDestination": { - "type": "GcsDestination", - "id": 1 - }, - "batchSize": { - "type": "int32", - "id": 2 - } - } - }, - "GcsSource": { - "fields": { - "uri": { - "type": "string", - "id": 1 - } - } - }, - "GcsDestination": { - "fields": { - "uri": { - "type": "string", - "id": 1 - } - } - }, - "OperationMetadata": { - "fields": { - "state": { - "type": "State", - "id": 1 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "CREATED": 1, - "RUNNING": 2, - "DONE": 3, - "CANCELLED": 4 - } - } - } - }, - "ProductSearchParams": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 9 - }, - "productSet": { - "type": "string", - "id": 6, - "options": { - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "productCategories": { - "rule": "repeated", - "type": "string", - "id": 7 - }, - "filter": { - "type": "string", - "id": 8 - } - } - }, - "ProductSearchResults": { - "fields": { - "indexTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "results": { - "rule": "repeated", - "type": "Result", - "id": 5 - }, - "productGroupedResults": { - "rule": "repeated", - "type": "GroupedResult", - "id": 6 - } - }, - "nested": { - "Result": { - "fields": { - "product": { - "type": "Product", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "image": { - "type": "string", - "id": 3 - } - } - }, - "ObjectAnnotation": { - "fields": { - "mid": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "score": { - "type": "float", - "id": 4 - } - } - }, - "GroupedResult": { - "fields": { - "boundingPoly": { - "type": "BoundingPoly", - "id": 1 - }, - "results": { - "rule": "repeated", - "type": "Result", - "id": 2 - }, - "objectAnnotations": { - "rule": "repeated", - "type": "ObjectAnnotation", - "id": 3 - } - } - } - } - }, - "ProductSearch": { - "options": { - "(google.api.default_host)": "vision.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-vision" - }, - "methods": { - "CreateProductSet": { - "requestType": "CreateProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).post": "/v1p4beta1/{parent=projects/*/locations/*}/productSets", - "(google.api.http).body": "product_set", - "(google.api.method_signature)": "parent,product_set,product_set_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/{parent=projects/*/locations/*}/productSets", - "body": "product_set" - } - }, - { - "(google.api.method_signature)": "parent,product_set,product_set_id" - } - ] - }, - "ListProductSets": { - "requestType": "ListProductSetsRequest", - "responseType": "ListProductSetsResponse", - "options": { - "(google.api.http).get": "/v1p4beta1/{parent=projects/*/locations/*}/productSets", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p4beta1/{parent=projects/*/locations/*}/productSets" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetProductSet": { - "requestType": "GetProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).get": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "UpdateProductSet": { - "requestType": "UpdateProductSetRequest", - "responseType": "ProductSet", - "options": { - "(google.api.http).patch": "/v1p4beta1/{product_set.name=projects/*/locations/*/productSets/*}", - "(google.api.http).body": "product_set", - "(google.api.method_signature)": "product_set,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1p4beta1/{product_set.name=projects/*/locations/*/productSets/*}", - "body": "product_set" - } - }, - { - "(google.api.method_signature)": "product_set,update_mask" - } - ] - }, - "DeleteProductSet": { - "requestType": "DeleteProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CreateProduct": { - "requestType": "CreateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).post": "/v1p4beta1/{parent=projects/*/locations/*}/products", - "(google.api.http).body": "product", - "(google.api.method_signature)": "parent,product,product_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/{parent=projects/*/locations/*}/products", - "body": "product" - } - }, - { - "(google.api.method_signature)": "parent,product,product_id" - } - ] - }, - "ListProducts": { - "requestType": "ListProductsRequest", - "responseType": "ListProductsResponse", - "options": { - "(google.api.http).get": "/v1p4beta1/{parent=projects/*/locations/*}/products", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p4beta1/{parent=projects/*/locations/*}/products" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetProduct": { - "requestType": "GetProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).get": "/v1p4beta1/{name=projects/*/locations/*/products/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p4beta1/{name=projects/*/locations/*/products/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "UpdateProduct": { - "requestType": "UpdateProductRequest", - "responseType": "Product", - "options": { - "(google.api.http).patch": "/v1p4beta1/{product.name=projects/*/locations/*/products/*}", - "(google.api.http).body": "product", - "(google.api.method_signature)": "product,update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1p4beta1/{product.name=projects/*/locations/*/products/*}", - "body": "product" - } - }, - { - "(google.api.method_signature)": "product,update_mask" - } - ] - }, - "DeleteProduct": { - "requestType": "DeleteProductRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1p4beta1/{name=projects/*/locations/*/products/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1p4beta1/{name=projects/*/locations/*/products/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CreateReferenceImage": { - "requestType": "CreateReferenceImageRequest", - "responseType": "ReferenceImage", - "options": { - "(google.api.http).post": "/v1p4beta1/{parent=projects/*/locations/*/products/*}/referenceImages", - "(google.api.http).body": "reference_image", - "(google.api.method_signature)": "parent,reference_image,reference_image_id" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/{parent=projects/*/locations/*/products/*}/referenceImages", - "body": "reference_image" - } - }, - { - "(google.api.method_signature)": "parent,reference_image,reference_image_id" - } - ] - }, - "DeleteReferenceImage": { - "requestType": "DeleteReferenceImageRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1p4beta1/{name=projects/*/locations/*/products/*/referenceImages/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1p4beta1/{name=projects/*/locations/*/products/*/referenceImages/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ListReferenceImages": { - "requestType": "ListReferenceImagesRequest", - "responseType": "ListReferenceImagesResponse", - "options": { - "(google.api.http).get": "/v1p4beta1/{parent=projects/*/locations/*/products/*}/referenceImages", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p4beta1/{parent=projects/*/locations/*/products/*}/referenceImages" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "GetReferenceImage": { - "requestType": "GetReferenceImageRequest", - "responseType": "ReferenceImage", - "options": { - "(google.api.http).get": "/v1p4beta1/{name=projects/*/locations/*/products/*/referenceImages/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p4beta1/{name=projects/*/locations/*/products/*/referenceImages/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "AddProductToProductSet": { - "requestType": "AddProductToProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}:addProduct", - "(google.api.http).body": "*", - "(google.api.method_signature)": "name,product" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}:addProduct", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name,product" - } - ] - }, - "RemoveProductFromProductSet": { - "requestType": "RemoveProductFromProductSetRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}:removeProduct", - "(google.api.http).body": "*", - "(google.api.method_signature)": "name,product" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}:removeProduct", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name,product" - } - ] - }, - "ListProductsInProductSet": { - "requestType": "ListProductsInProductSetRequest", - "responseType": "ListProductsInProductSetResponse", - "options": { - "(google.api.http).get": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}/products", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1p4beta1/{name=projects/*/locations/*/productSets/*}/products" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ImportProductSets": { - "requestType": "ImportProductSetsRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1p4beta1/{parent=projects/*/locations/*}/productSets:import", - "(google.api.http).body": "*", - "(google.api.method_signature)": "parent,input_config", - "(google.longrunning.operation_info).response_type": "ImportProductSetsResponse", - "(google.longrunning.operation_info).metadata_type": "BatchOperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/{parent=projects/*/locations/*}/productSets:import", - "body": "*" - } - }, - { - "(google.api.method_signature)": "parent,input_config" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "ImportProductSetsResponse", - "metadata_type": "BatchOperationMetadata" - } - } - ] - }, - "PurgeProducts": { - "requestType": "PurgeProductsRequest", - "responseType": "google.longrunning.Operation", - "options": { - "(google.api.http).post": "/v1p4beta1/{parent=projects/*/locations/*}/products:purge", - "(google.api.http).body": "*", - "(google.api.method_signature)": "parent", - "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", - "(google.longrunning.operation_info).metadata_type": "BatchOperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1p4beta1/{parent=projects/*/locations/*}/products:purge", - "body": "*" - } - }, - { - "(google.api.method_signature)": "parent" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "google.protobuf.Empty", - "metadata_type": "BatchOperationMetadata" - } - } - ] - } - } - }, - "Product": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/Product", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/products/{product}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "displayName": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - }, - "productCategory": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "IMMUTABLE" - } - }, - "productLabels": { - "rule": "repeated", - "type": "KeyValue", - "id": 5 - } - }, - "nested": { - "KeyValue": { - "fields": { - "key": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - } - } - } - } - }, - "ProductSet": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/ProductSet", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/productSets/{product_set}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "displayName": { - "type": "string", - "id": 2 - }, - "indexTime": { - "type": "google.protobuf.Timestamp", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "indexError": { - "type": "google.rpc.Status", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "ReferenceImage": { - "options": { - "(google.api.resource).type": "vision.googleapis.com/ReferenceImage", - "(google.api.resource).pattern": "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}" - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "uri": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "boundingPolys": { - "rule": "repeated", - "type": "BoundingPoly", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "CreateProductRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "product": { - "type": "Product", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "productId": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsResponse": { - "fields": { - "products": { - "rule": "repeated", - "type": "Product", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetProductRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "UpdateProductRequest": { - "fields": { - "product": { - "type": "Product", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "DeleteProductRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "CreateProductSetRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "productSet": { - "type": "ProductSet", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "productSetId": { - "type": "string", - "id": 3 - } - } - }, - "ListProductSetsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductSetsResponse": { - "fields": { - "productSets": { - "rule": "repeated", - "type": "ProductSet", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "GetProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - } - } - }, - "UpdateProductSetRequest": { - "fields": { - "productSet": { - "type": "ProductSet", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "DeleteProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - } - } - }, - "CreateReferenceImageRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - }, - "referenceImage": { - "type": "ReferenceImage", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "referenceImageId": { - "type": "string", - "id": 3 - } - } - }, - "ListReferenceImagesRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListReferenceImagesResponse": { - "fields": { - "referenceImages": { - "rule": "repeated", - "type": "ReferenceImage", - "id": 1 - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3 - } - } - }, - "GetReferenceImageRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ReferenceImage" - } - } - } - }, - "DeleteReferenceImageRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ReferenceImage" - } - } - } - }, - "AddProductToProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "product": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "RemoveProductFromProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "product": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/Product" - } - } - } - }, - "ListProductsInProductSetRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "vision.googleapis.com/ProductSet" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListProductsInProductSetResponse": { - "fields": { - "products": { - "rule": "repeated", - "type": "Product", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "ImportProductSetsGcsSource": { - "fields": { - "csvFileUri": { - "type": "string", - "id": 1 - } - } - }, - "ImportProductSetsInputConfig": { - "oneofs": { - "source": { - "oneof": [ - "gcsSource" - ] - } - }, - "fields": { - "gcsSource": { - "type": "ImportProductSetsGcsSource", - "id": 1 - } - } - }, - "ImportProductSetsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "inputConfig": { - "type": "ImportProductSetsInputConfig", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "ImportProductSetsResponse": { - "fields": { - "referenceImages": { - "rule": "repeated", - "type": "ReferenceImage", - "id": 1 - }, - "statuses": { - "rule": "repeated", - "type": "google.rpc.Status", - "id": 2 - } - } - }, - "BatchOperationMetadata": { - "fields": { - "state": { - "type": "State", - "id": 1 - }, - "submitTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - } - }, - "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "PROCESSING": 1, - "SUCCESSFUL": 2, - "FAILED": 3, - "CANCELLED": 4 - } - } - } - }, - "ProductSetPurgeConfig": { - "fields": { - "productSetId": { - "type": "string", - "id": 1 - } - } - }, - "PurgeProductsRequest": { - "oneofs": { - "target": { - "oneof": [ - "productSetPurgeConfig", - "deleteOrphanProducts" - ] - } - }, - "fields": { - "productSetPurgeConfig": { - "type": "ProductSetPurgeConfig", - "id": 2 - }, - "deleteOrphanProducts": { - "type": "bool", - "id": 3 - }, - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "locations.googleapis.com/Location" - } - }, - "force": { - "type": "bool", - "id": 4 - } - } - }, - "TextAnnotation": { - "fields": { - "pages": { - "rule": "repeated", - "type": "Page", - "id": 1 - }, - "text": { - "type": "string", - "id": 2 - } - }, - "nested": { - "DetectedLanguage": { - "fields": { - "languageCode": { - "type": "string", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - } - } - }, - "DetectedBreak": { - "fields": { - "type": { - "type": "BreakType", - "id": 1 - }, - "isPrefix": { - "type": "bool", - "id": 2 - } - }, - "nested": { - "BreakType": { - "values": { - "UNKNOWN": 0, - "SPACE": 1, - "SURE_SPACE": 2, - "EOL_SURE_SPACE": 3, - "HYPHEN": 4, - "LINE_BREAK": 5 - } - } - } - }, - "TextProperty": { - "fields": { - "detectedLanguages": { - "rule": "repeated", - "type": "DetectedLanguage", - "id": 1 - }, - "detectedBreak": { - "type": "DetectedBreak", - "id": 2 - } - } - } - } - }, - "Page": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "width": { - "type": "int32", - "id": 2 - }, - "height": { - "type": "int32", - "id": 3 - }, - "blocks": { - "rule": "repeated", - "type": "Block", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - } - }, - "Block": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "paragraphs": { - "rule": "repeated", - "type": "Paragraph", - "id": 3 - }, - "blockType": { - "type": "BlockType", - "id": 4 - }, - "confidence": { - "type": "float", - "id": 5 - } - }, - "nested": { - "BlockType": { - "values": { - "UNKNOWN": 0, - "TEXT": 1, - "TABLE": 2, - "PICTURE": 3, - "RULER": 4, - "BARCODE": 5 - } - } - } - }, - "Paragraph": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "words": { - "rule": "repeated", - "type": "Word", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Word": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "symbols": { - "rule": "repeated", - "type": "Symbol", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "Symbol": { - "fields": { - "property": { - "type": "TextAnnotation.TextProperty", - "id": 1 - }, - "boundingBox": { - "type": "BoundingPoly", - "id": 2 - }, - "text": { - "type": "string", - "id": 3 - }, - "confidence": { - "type": "float", - "id": 4 - } - } - }, - "WebDetection": { - "fields": { - "webEntities": { - "rule": "repeated", - "type": "WebEntity", - "id": 1 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 2 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 3 - }, - "pagesWithMatchingImages": { - "rule": "repeated", - "type": "WebPage", - "id": 4 - }, - "visuallySimilarImages": { - "rule": "repeated", - "type": "WebImage", - "id": 6 - }, - "bestGuessLabels": { - "rule": "repeated", - "type": "WebLabel", - "id": 8 - } - }, - "nested": { - "WebEntity": { - "fields": { - "entityId": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - } - } - }, - "WebImage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - } - } - }, - "WebPage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "score": { - "type": "float", - "id": 2 - }, - "pageTitle": { - "type": "string", - "id": 3 - }, - "fullMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 4 - }, - "partialMatchingImages": { - "rule": "repeated", - "type": "WebImage", - "id": 5 - } - } - }, - "WebLabel": { - "fields": { - "label": { - "type": "string", - "id": 1 - }, - "languageCode": { - "type": "string", - "id": 2 - } - } - } - } - } - } - } - } - } - } - }, - "api": { - "options": { - "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", - "java_multiple_files": true, - "java_outer_classname": "ResourceProto", - "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true - }, - "nested": { - "http": { - "type": "HttpRule", - "id": 72295728, - "extend": "google.protobuf.MethodOptions" - }, - "Http": { - "fields": { - "rules": { - "rule": "repeated", - "type": "HttpRule", - "id": 1 - }, - "fullyDecodeReservedExpansion": { - "type": "bool", - "id": 2 - } - } - }, - "HttpRule": { - "oneofs": { - "pattern": { - "oneof": [ - "get", - "put", - "post", - "delete", - "patch", - "custom" - ] - } - }, - "fields": { - "selector": { - "type": "string", - "id": 1 - }, - "get": { - "type": "string", - "id": 2 - }, - "put": { - "type": "string", - "id": 3 - }, - "post": { - "type": "string", - "id": 4 - }, - "delete": { - "type": "string", - "id": 5 - }, - "patch": { - "type": "string", - "id": 6 - }, - "custom": { - "type": "CustomHttpPattern", - "id": 8 - }, - "body": { - "type": "string", - "id": 7 - }, - "responseBody": { - "type": "string", - "id": 12 - }, - "additionalBindings": { - "rule": "repeated", - "type": "HttpRule", - "id": 11 - } - } - }, - "CustomHttpPattern": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "path": { - "type": "string", - "id": 2 - } - } - }, - "methodSignature": { - "rule": "repeated", - "type": "string", - "id": 1051, - "extend": "google.protobuf.MethodOptions" - }, - "defaultHost": { - "type": "string", - "id": 1049, - "extend": "google.protobuf.ServiceOptions" - }, - "oauthScopes": { - "type": "string", - "id": 1050, - "extend": "google.protobuf.ServiceOptions" - }, - "fieldBehavior": { - "rule": "repeated", - "type": "google.api.FieldBehavior", - "id": 1052, - "extend": "google.protobuf.FieldOptions" - }, - "FieldBehavior": { - "values": { - "FIELD_BEHAVIOR_UNSPECIFIED": 0, - "OPTIONAL": 1, - "REQUIRED": 2, - "OUTPUT_ONLY": 3, - "INPUT_ONLY": 4, - "IMMUTABLE": 5, - "UNORDERED_LIST": 6, - "NON_EMPTY_DEFAULT": 7 - } - }, - "resourceReference": { - "type": "google.api.ResourceReference", - "id": 1055, - "extend": "google.protobuf.FieldOptions" - }, - "resourceDefinition": { - "rule": "repeated", - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.FileOptions" - }, - "resource": { - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.MessageOptions" - }, - "ResourceDescriptor": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "pattern": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "nameField": { - "type": "string", - "id": 3 - }, - "history": { - "type": "History", - "id": 4 - }, - "plural": { - "type": "string", - "id": 5 - }, - "singular": { - "type": "string", - "id": 6 - }, - "style": { - "rule": "repeated", - "type": "Style", - "id": 10 - } - }, - "nested": { - "History": { - "values": { - "HISTORY_UNSPECIFIED": 0, - "ORIGINALLY_SINGLE_PATTERN": 1, - "FUTURE_MULTI_PATTERN": 2 - } - }, - "Style": { - "values": { - "STYLE_UNSPECIFIED": 0, - "DECLARATIVE_FRIENDLY": 1 - } - } - } - }, - "ResourceReference": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "childType": { - "type": "string", - "id": 2 - } - } - } - } - }, - "protobuf": { - "options": { - "go_package": "google.golang.org/protobuf/types/descriptorpb", - "java_package": "com.google.protobuf", - "java_outer_classname": "DescriptorProtos", - "csharp_namespace": "Google.Protobuf.Reflection", - "objc_class_prefix": "GPB", - "cc_enable_arenas": true, - "optimize_for": "SPEED" - }, - "nested": { - "FileDescriptorSet": { - "fields": { - "file": { - "rule": "repeated", - "type": "FileDescriptorProto", - "id": 1 - } - } - }, - "FileDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "package": { - "type": "string", - "id": 2 - }, - "dependency": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "publicDependency": { - "rule": "repeated", - "type": "int32", - "id": 10, - "options": { - "packed": false - } - }, - "weakDependency": { - "rule": "repeated", - "type": "int32", - "id": 11, - "options": { - "packed": false - } - }, - "messageType": { - "rule": "repeated", - "type": "DescriptorProto", - "id": 4 - }, - "enumType": { - "rule": "repeated", - "type": "EnumDescriptorProto", - "id": 5 - }, - "service": { - "rule": "repeated", - "type": "ServiceDescriptorProto", - "id": 6 - }, - "extension": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 7 - }, - "options": { - "type": "FileOptions", - "id": 8 - }, - "sourceCodeInfo": { - "type": "SourceCodeInfo", - "id": 9 - }, - "syntax": { - "type": "string", - "id": 12 - }, - "edition": { - "type": "string", - "id": 13 - } - } - }, - "DescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "field": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 2 - }, - "extension": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 6 - }, - "nestedType": { - "rule": "repeated", - "type": "DescriptorProto", - "id": 3 - }, - "enumType": { - "rule": "repeated", - "type": "EnumDescriptorProto", - "id": 4 - }, - "extensionRange": { - "rule": "repeated", - "type": "ExtensionRange", - "id": 5 - }, - "oneofDecl": { - "rule": "repeated", - "type": "OneofDescriptorProto", - "id": 8 - }, - "options": { - "type": "MessageOptions", - "id": 7 - }, - "reservedRange": { - "rule": "repeated", - "type": "ReservedRange", - "id": 9 - }, - "reservedName": { - "rule": "repeated", - "type": "string", - "id": 10 - } - }, - "nested": { - "ExtensionRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - }, - "options": { - "type": "ExtensionRangeOptions", - "id": 3 - } - } - }, - "ReservedRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - } - } - } - } - }, - "ExtensionRangeOptions": { - "fields": { - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "FieldDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 3 - }, - "label": { - "type": "Label", - "id": 4 - }, - "type": { - "type": "Type", - "id": 5 - }, - "typeName": { - "type": "string", - "id": 6 - }, - "extendee": { - "type": "string", - "id": 2 - }, - "defaultValue": { - "type": "string", - "id": 7 - }, - "oneofIndex": { - "type": "int32", - "id": 9 - }, - "jsonName": { - "type": "string", - "id": 10 - }, - "options": { - "type": "FieldOptions", - "id": 8 - }, - "proto3Optional": { - "type": "bool", - "id": 17 - } - }, - "nested": { - "Type": { - "values": { - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18 - } - }, - "Label": { - "values": { - "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, - "LABEL_REPEATED": 3 - } - } - } - }, - "OneofDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "options": { - "type": "OneofOptions", - "id": 2 - } - } - }, - "EnumDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "rule": "repeated", - "type": "EnumValueDescriptorProto", - "id": 2 - }, - "options": { - "type": "EnumOptions", - "id": 3 - }, - "reservedRange": { - "rule": "repeated", - "type": "EnumReservedRange", - "id": 4 - }, - "reservedName": { - "rule": "repeated", - "type": "string", - "id": 5 - } - }, - "nested": { - "EnumReservedRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - } - } - } - } - }, - "EnumValueDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 2 - }, - "options": { - "type": "EnumValueOptions", - "id": 3 - } - } - }, - "ServiceDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "method": { - "rule": "repeated", - "type": "MethodDescriptorProto", - "id": 2 - }, - "options": { - "type": "ServiceOptions", - "id": 3 - } - } - }, - "MethodDescriptorProto": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "inputType": { - "type": "string", - "id": 2 - }, - "outputType": { - "type": "string", - "id": 3 - }, - "options": { - "type": "MethodOptions", - "id": 4 - }, - "clientStreaming": { - "type": "bool", - "id": 5, - "options": { - "default": false - } - }, - "serverStreaming": { - "type": "bool", - "id": 6, - "options": { - "default": false - } - } - } - }, - "FileOptions": { - "fields": { - "javaPackage": { - "type": "string", - "id": 1 - }, - "javaOuterClassname": { - "type": "string", - "id": 8 - }, - "javaMultipleFiles": { - "type": "bool", - "id": 10, - "options": { - "default": false - } - }, - "javaGenerateEqualsAndHash": { - "type": "bool", - "id": 20, - "options": { - "deprecated": true - } - }, - "javaStringCheckUtf8": { - "type": "bool", - "id": 27, - "options": { - "default": false - } - }, - "optimizeFor": { - "type": "OptimizeMode", - "id": 9, - "options": { - "default": "SPEED" - } - }, - "goPackage": { - "type": "string", - "id": 11 - }, - "ccGenericServices": { - "type": "bool", - "id": 16, - "options": { - "default": false - } - }, - "javaGenericServices": { - "type": "bool", - "id": 17, - "options": { - "default": false - } - }, - "pyGenericServices": { - "type": "bool", - "id": 18, - "options": { - "default": false - } - }, - "phpGenericServices": { - "type": "bool", - "id": 42, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 23, - "options": { - "default": false - } - }, - "ccEnableArenas": { - "type": "bool", - "id": 31, - "options": { - "default": true - } - }, - "objcClassPrefix": { - "type": "string", - "id": 36 - }, - "csharpNamespace": { - "type": "string", - "id": 37 - }, - "swiftPrefix": { - "type": "string", - "id": 39 - }, - "phpClassPrefix": { - "type": "string", - "id": 40 - }, - "phpNamespace": { - "type": "string", - "id": 41 - }, - "phpMetadataNamespace": { - "type": "string", - "id": 44 - }, - "rubyPackage": { - "type": "string", - "id": 45 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 38, - 38 - ] - ], - "nested": { - "OptimizeMode": { - "values": { - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3 - } - } - } - }, - "MessageOptions": { - "fields": { - "messageSetWireFormat": { - "type": "bool", - "id": 1, - "options": { - "default": false - } - }, - "noStandardDescriptorAccessor": { - "type": "bool", - "id": 2, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "mapEntry": { - "type": "bool", - "id": 7 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 4, - 4 - ], - [ - 5, - 5 - ], - [ - 6, - 6 - ], - [ - 8, - 8 - ], - [ - 9, - 9 - ] - ] - }, - "FieldOptions": { - "fields": { - "ctype": { - "type": "CType", - "id": 1, - "options": { - "default": "STRING" - } - }, - "packed": { - "type": "bool", - "id": 2 - }, - "jstype": { - "type": "JSType", - "id": 6, - "options": { - "default": "JS_NORMAL" - } - }, - "lazy": { - "type": "bool", - "id": 5, - "options": { - "default": false - } - }, - "unverifiedLazy": { - "type": "bool", - "id": 15, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "weak": { - "type": "bool", - "id": 10, - "options": { - "default": false - } - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 4, - 4 - ] - ], - "nested": { - "CType": { - "values": { - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2 - } - }, - "JSType": { - "values": { - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2 - } - } - } - }, - "OneofOptions": { - "fields": { - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "EnumOptions": { - "fields": { - "allowAlias": { - "type": "bool", - "id": 2 - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 5, - 5 - ] - ] - }, - "EnumValueOptions": { - "fields": { - "deprecated": { - "type": "bool", - "id": 1, - "options": { - "default": false - } - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "ServiceOptions": { - "fields": { - "deprecated": { - "type": "bool", - "id": 33, - "options": { - "default": false - } - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "MethodOptions": { - "fields": { - "deprecated": { - "type": "bool", - "id": 33, - "options": { - "default": false - } - }, - "idempotencyLevel": { - "type": "IdempotencyLevel", - "id": 34, - "options": { - "default": "IDEMPOTENCY_UNKNOWN" - } - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "nested": { - "IdempotencyLevel": { - "values": { - "IDEMPOTENCY_UNKNOWN": 0, - "NO_SIDE_EFFECTS": 1, - "IDEMPOTENT": 2 - } - } - } - }, - "UninterpretedOption": { - "fields": { - "name": { - "rule": "repeated", - "type": "NamePart", - "id": 2 - }, - "identifierValue": { - "type": "string", - "id": 3 - }, - "positiveIntValue": { - "type": "uint64", - "id": 4 - }, - "negativeIntValue": { - "type": "int64", - "id": 5 - }, - "doubleValue": { - "type": "double", - "id": 6 - }, - "stringValue": { - "type": "bytes", - "id": 7 - }, - "aggregateValue": { - "type": "string", - "id": 8 - } - }, - "nested": { - "NamePart": { - "fields": { - "namePart": { - "rule": "required", - "type": "string", - "id": 1 - }, - "isExtension": { - "rule": "required", - "type": "bool", - "id": 2 - } - } - } - } - }, - "SourceCodeInfo": { - "fields": { - "location": { - "rule": "repeated", - "type": "Location", - "id": 1 - } - }, - "nested": { - "Location": { - "fields": { - "path": { - "rule": "repeated", - "type": "int32", - "id": 1 - }, - "span": { - "rule": "repeated", - "type": "int32", - "id": 2 - }, - "leadingComments": { - "type": "string", - "id": 3 - }, - "trailingComments": { - "type": "string", - "id": 4 - }, - "leadingDetachedComments": { - "rule": "repeated", - "type": "string", - "id": 6 - } - } - } - } - }, - "GeneratedCodeInfo": { - "fields": { - "annotation": { - "rule": "repeated", - "type": "Annotation", - "id": 1 - } - }, - "nested": { - "Annotation": { - "fields": { - "path": { - "rule": "repeated", - "type": "int32", - "id": 1 - }, - "sourceFile": { - "type": "string", - "id": 2 - }, - "begin": { - "type": "int32", - "id": 3 - }, - "end": { - "type": "int32", - "id": 4 - }, - "semantic": { - "type": "Semantic", - "id": 5 - } - }, - "nested": { - "Semantic": { - "values": { - "NONE": 0, - "SET": 1, - "ALIAS": 2 - } - } - } - } - } - }, - "Any": { - "fields": { - "type_url": { - "type": "string", - "id": 1 - }, - "value": { - "type": "bytes", - "id": 2 - } - } - }, - "Duration": { - "fields": { - "seconds": { - "type": "int64", - "id": 1 - }, - "nanos": { - "type": "int32", - "id": 2 - } - } - }, - "Empty": { - "fields": {} - }, - "FieldMask": { - "fields": { - "paths": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - }, - "Timestamp": { - "fields": { - "seconds": { - "type": "int64", - "id": 1 - }, - "nanos": { - "type": "int32", - "id": 2 - } - } - }, - "DoubleValue": { - "fields": { - "value": { - "type": "double", - "id": 1 - } - } - }, - "FloatValue": { - "fields": { - "value": { - "type": "float", - "id": 1 - } - } - }, - "Int64Value": { - "fields": { - "value": { - "type": "int64", - "id": 1 - } - } - }, - "UInt64Value": { - "fields": { - "value": { - "type": "uint64", - "id": 1 - } - } - }, - "Int32Value": { - "fields": { - "value": { - "type": "int32", - "id": 1 - } - } - }, - "UInt32Value": { - "fields": { - "value": { - "type": "uint32", - "id": 1 - } - } - }, - "BoolValue": { - "fields": { - "value": { - "type": "bool", - "id": 1 - } - } - }, - "StringValue": { - "fields": { - "value": { - "type": "string", - "id": 1 - } - } - }, - "BytesValue": { - "fields": { - "value": { - "type": "bytes", - "id": 1 - } - } - } - } - }, - "longrunning": { - "options": { - "cc_enable_arenas": true, - "csharp_namespace": "Google.LongRunning", - "go_package": "google.golang.org/genproto/googleapis/longrunning;longrunning", - "java_multiple_files": true, - "java_outer_classname": "OperationsProto", - "java_package": "com.google.longrunning", - "php_namespace": "Google\\LongRunning" - }, - "nested": { - "operationInfo": { - "type": "google.longrunning.OperationInfo", - "id": 1049, - "extend": "google.protobuf.MethodOptions" - }, - "Operations": { - "options": { - "(google.api.default_host)": "longrunning.googleapis.com" - }, - "methods": { - "ListOperations": { - "requestType": "ListOperationsRequest", - "responseType": "ListOperationsResponse", - "options": { - "(google.api.http).get": "/v1/{name=operations}", - "(google.api.method_signature)": "name,filter" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=operations}" - } - }, - { - "(google.api.method_signature)": "name,filter" - } - ] - }, - "GetOperation": { - "requestType": "GetOperationRequest", - "responseType": "Operation", - "options": { - "(google.api.http).get": "/v1/{name=operations/**}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=operations/**}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "DeleteOperation": { - "requestType": "DeleteOperationRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1/{name=operations/**}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=operations/**}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "CancelOperation": { - "requestType": "CancelOperationRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1/{name=operations/**}:cancel", - "(google.api.http).body": "*", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{name=operations/**}:cancel", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "WaitOperation": { - "requestType": "WaitOperationRequest", - "responseType": "Operation" - } - } - }, - "Operation": { - "oneofs": { - "result": { - "oneof": [ - "error", - "response" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "metadata": { - "type": "google.protobuf.Any", - "id": 2 - }, - "done": { - "type": "bool", - "id": 3 - }, - "error": { - "type": "google.rpc.Status", - "id": 4 - }, - "response": { - "type": "google.protobuf.Any", - "id": 5 - } - } - }, - "GetOperationRequest": { - "fields": { - "name": { - "type": "string", - "id": 1 - } - } - }, - "ListOperationsRequest": { - "fields": { - "name": { - "type": "string", - "id": 4 - }, - "filter": { - "type": "string", - "id": 1 - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - } - } - }, - "ListOperationsResponse": { - "fields": { - "operations": { - "rule": "repeated", - "type": "Operation", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - } - } - }, - "CancelOperationRequest": { - "fields": { - "name": { - "type": "string", - "id": 1 - } - } - }, - "DeleteOperationRequest": { - "fields": { - "name": { - "type": "string", - "id": 1 - } - } - }, - "WaitOperationRequest": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "timeout": { - "type": "google.protobuf.Duration", - "id": 2 - } - } - }, - "OperationInfo": { - "fields": { - "responseType": { - "type": "string", - "id": 1 - }, - "metadataType": { - "type": "string", - "id": 2 - } - } - } - } - }, - "rpc": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", - "java_multiple_files": true, - "java_outer_classname": "StatusProto", - "java_package": "com.google.rpc", - "objc_class_prefix": "RPC" - }, - "nested": { - "Status": { - "fields": { - "code": { - "type": "int32", - "id": 1 - }, - "message": { - "type": "string", - "id": 2 - }, - "details": { - "rule": "repeated", - "type": "google.protobuf.Any", - "id": 3 - } - } - } - } - }, - "type": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/type/latlng;latlng", - "java_multiple_files": true, - "java_outer_classname": "LatLngProto", - "java_package": "com.google.type", - "objc_class_prefix": "GTP" - }, - "nested": { - "Color": { - "fields": { - "red": { - "type": "float", - "id": 1 - }, - "green": { - "type": "float", - "id": 2 - }, - "blue": { - "type": "float", - "id": 3 - }, - "alpha": { - "type": "google.protobuf.FloatValue", - "id": 4 - } - } - }, - "LatLng": { - "fields": { - "latitude": { - "type": "double", - "id": 1 - }, - "longitude": { - "type": "double", - "id": 2 - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 26428fcf..00000000 --- a/renovate.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": [ - "config:base", - "docker:disable", - ":disableDependencyDashboard" - ], - "pinVersions": false, - "rebaseStalePrs": true, - "schedule": [ - "after 9am and before 3pm" - ], - "gitAuthor": null, - "packageRules": [ - { - "extends": "packages:linters", - "groupName": "linters" - } - ], - "ignoreDeps": ["typescript"] -} diff --git a/samples/.eslintrc.yml b/samples/.eslintrc.yml deleted file mode 100644 index 98634adb..00000000 --- a/samples/.eslintrc.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -rules: - no-console: off - node/no-unsupported-features/node-builtins: off diff --git a/samples/README.md b/samples/README.md deleted file mode 100644 index 639f9ffa..00000000 --- a/samples/README.md +++ /dev/null @@ -1,7 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "To regenerate it, use `python -m synthtool`." -Google Cloud Platform logo - -# [Google Cloud Vision API: Node.js Samples](https://github.com/googleapis/nodejs-vision) - -All samples have been migrated [here](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/main/vision). \ No newline at end of file diff --git a/samples/generated/v1/image_annotator.async_batch_annotate_files.js b/samples/generated/v1/image_annotator.async_batch_annotate_files.js deleted file mode 100644 index 082eaef0..00000000 --- a/samples/generated/v1/image_annotator.async_batch_annotate_files.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual async file annotation requests for this batch. - */ - // const requests = 1234 - /** - * 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`. - */ - // const parent = 'abc123' - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callAsyncBatchAnnotateFiles() { - // Construct request - const request = { - requests, - }; - - // Run request - const [operation] = await visionClient.asyncBatchAnnotateFiles(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAsyncBatchAnnotateFiles(); - // [END vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/image_annotator.async_batch_annotate_images.js b/samples/generated/v1/image_annotator.async_batch_annotate_images.js deleted file mode 100644 index 9c97f2a2..00000000 --- a/samples/generated/v1/image_annotator.async_batch_annotate_images.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests, outputConfig) { - // [START vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual image annotation requests for this batch. - */ - // const requests = 1234 - /** - * Required. The desired output location and metadata (e.g. format). - */ - // const outputConfig = {} - /** - * 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`. - */ - // const parent = 'abc123' - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callAsyncBatchAnnotateImages() { - // Construct request - const request = { - requests, - outputConfig, - }; - - // Run request - const [operation] = await visionClient.asyncBatchAnnotateImages(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAsyncBatchAnnotateImages(); - // [END vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/image_annotator.batch_annotate_files.js b/samples/generated/v1/image_annotator.batch_annotate_files.js deleted file mode 100644 index f2b2930c..00000000 --- a/samples/generated/v1/image_annotator.batch_annotate_files.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The list of file annotation requests. Right now we support only one - * AnnotateFileRequest in BatchAnnotateFilesRequest. - */ - // const requests = 1234 - /** - * 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`. - */ - // const parent = 'abc123' - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callBatchAnnotateFiles() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await visionClient.batchAnnotateFiles(request); - console.log(response); - } - - callBatchAnnotateFiles(); - // [END vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/image_annotator.batch_annotate_images.js b/samples/generated/v1/image_annotator.batch_annotate_images.js deleted file mode 100644 index 991ca9d7..00000000 --- a/samples/generated/v1/image_annotator.batch_annotate_images.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1_generated_ImageAnnotator_BatchAnnotateImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual image annotation requests for this batch. - */ - // const requests = 1234 - /** - * 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`. - */ - // const parent = 'abc123' - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callBatchAnnotateImages() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await visionClient.batchAnnotateImages(request); - console.log(response); - } - - callBatchAnnotateImages(); - // [END vision_v1_generated_ImageAnnotator_BatchAnnotateImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.add_product_to_product_set.js b/samples/generated/v1/product_search.add_product_to_product_set.js deleted file mode 100644 index c21264f4..00000000 --- a/samples/generated/v1/product_search.add_product_to_product_set.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, product) { - // [START vision_v1_generated_ProductSearch_AddProductToProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the ProductSet to modify. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * Required. The resource name for the Product to be added to this ProductSet. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const product = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callAddProductToProductSet() { - // Construct request - const request = { - name, - product, - }; - - // Run request - const response = await visionClient.addProductToProductSet(request); - console.log(response); - } - - callAddProductToProductSet(); - // [END vision_v1_generated_ProductSearch_AddProductToProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.create_product.js b/samples/generated/v1/product_search.create_product.js deleted file mode 100644 index b9c709fc..00000000 --- a/samples/generated/v1/product_search.create_product.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, product) { - // [START vision_v1_generated_ProductSearch_CreateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the Product should be created. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The product to create. - */ - // const product = {} - /** - * 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 `/`. - */ - // const productId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateProduct() { - // Construct request - const request = { - parent, - product, - }; - - // Run request - const response = await visionClient.createProduct(request); - console.log(response); - } - - callCreateProduct(); - // [END vision_v1_generated_ProductSearch_CreateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.create_product_set.js b/samples/generated/v1/product_search.create_product_set.js deleted file mode 100644 index 81702d1a..00000000 --- a/samples/generated/v1/product_search.create_product_set.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, productSet) { - // [START vision_v1_generated_ProductSearch_CreateProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the ProductSet should be created. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The ProductSet to create. - */ - // const productSet = {} - /** - * 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 `/`. - */ - // const productSetId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateProductSet() { - // Construct request - const request = { - parent, - productSet, - }; - - // Run request - const response = await visionClient.createProductSet(request); - console.log(response); - } - - callCreateProductSet(); - // [END vision_v1_generated_ProductSearch_CreateProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.create_reference_image.js b/samples/generated/v1/product_search.create_reference_image.js deleted file mode 100644 index 8506cd1a..00000000 --- a/samples/generated/v1/product_search.create_reference_image.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, referenceImage) { - // [START vision_v1_generated_ProductSearch_CreateReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the product in which to create the reference image. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - */ - // const parent = 'abc123' - /** - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - */ - // const referenceImage = {} - /** - * 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 `/`. - */ - // const referenceImageId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateReferenceImage() { - // Construct request - const request = { - parent, - referenceImage, - }; - - // Run request - const response = await visionClient.createReferenceImage(request); - console.log(response); - } - - callCreateReferenceImage(); - // [END vision_v1_generated_ProductSearch_CreateReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.delete_product.js b/samples/generated/v1/product_search.delete_product.js deleted file mode 100644 index 91a489bd..00000000 --- a/samples/generated/v1/product_search.delete_product.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1_generated_ProductSearch_DeleteProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of product to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteProduct(request); - console.log(response); - } - - callDeleteProduct(); - // [END vision_v1_generated_ProductSearch_DeleteProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.delete_product_set.js b/samples/generated/v1/product_search.delete_product_set.js deleted file mode 100644 index 1586c169..00000000 --- a/samples/generated/v1/product_search.delete_product_set.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1_generated_ProductSearch_DeleteProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the ProductSet to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteProductSet(request); - console.log(response); - } - - callDeleteProductSet(); - // [END vision_v1_generated_ProductSearch_DeleteProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.delete_reference_image.js b/samples/generated/v1/product_search.delete_reference_image.js deleted file mode 100644 index 6e489d98..00000000 --- a/samples/generated/v1/product_search.delete_reference_image.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1_generated_ProductSearch_DeleteReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the reference image to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteReferenceImage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteReferenceImage(request); - console.log(response); - } - - callDeleteReferenceImage(); - // [END vision_v1_generated_ProductSearch_DeleteReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.get_product.js b/samples/generated/v1/product_search.get_product.js deleted file mode 100644 index c9d6392a..00000000 --- a/samples/generated/v1/product_search.get_product.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1_generated_ProductSearch_GetProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the Product to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getProduct(request); - console.log(response); - } - - callGetProduct(); - // [END vision_v1_generated_ProductSearch_GetProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.get_product_set.js b/samples/generated/v1/product_search.get_product_set.js deleted file mode 100644 index c08dea70..00000000 --- a/samples/generated/v1/product_search.get_product_set.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1_generated_ProductSearch_GetProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the ProductSet to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getProductSet(request); - console.log(response); - } - - callGetProductSet(); - // [END vision_v1_generated_ProductSearch_GetProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.get_reference_image.js b/samples/generated/v1/product_search.get_reference_image.js deleted file mode 100644 index e7429e85..00000000 --- a/samples/generated/v1/product_search.get_reference_image.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1_generated_ProductSearch_GetReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ReferenceImage to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetReferenceImage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getReferenceImage(request); - console.log(response); - } - - callGetReferenceImage(); - // [END vision_v1_generated_ProductSearch_GetReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.import_product_sets.js b/samples/generated/v1/product_search.import_product_sets.js deleted file mode 100644 index e30166c4..00000000 --- a/samples/generated/v1/product_search.import_product_sets.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START vision_v1_generated_ProductSearch_ImportProductSets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the ProductSets should be imported. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The input content for the list of requests. - */ - // const inputConfig = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callImportProductSets() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await visionClient.importProductSets(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportProductSets(); - // [END vision_v1_generated_ProductSearch_ImportProductSets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.list_product_sets.js b/samples/generated/v1/product_search.list_product_sets.js deleted file mode 100644 index e5bf4df1..00000000 --- a/samples/generated/v1/product_search.list_product_sets.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1_generated_ProductSearch_ListProductSets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project from which ProductSets should be listed. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProductSets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listProductSetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProductSets(); - // [END vision_v1_generated_ProductSearch_ListProductSets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.list_products.js b/samples/generated/v1/product_search.list_products.js deleted file mode 100644 index 41893451..00000000 --- a/samples/generated/v1/product_search.list_products.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1_generated_ProductSearch_ListProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project OR ProductSet from which Products should be listed. - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProducts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listProductsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProducts(); - // [END vision_v1_generated_ProductSearch_ListProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.list_products_in_product_set.js b/samples/generated/v1/product_search.list_products_in_product_set.js deleted file mode 100644 index 9e6d0b77..00000000 --- a/samples/generated/v1/product_search.list_products_in_product_set.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1_generated_ProductSearch_ListProductsInProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ProductSet resource for which to retrieve Products. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProductsInProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await visionClient.listProductsInProductSetAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProductsInProductSet(); - // [END vision_v1_generated_ProductSearch_ListProductsInProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.list_reference_images.js b/samples/generated/v1/product_search.list_reference_images.js deleted file mode 100644 index f2c5a69c..00000000 --- a/samples/generated/v1/product_search.list_reference_images.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1_generated_ProductSearch_ListReferenceImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the product containing the reference images. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * 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. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListReferenceImages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listReferenceImagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListReferenceImages(); - // [END vision_v1_generated_ProductSearch_ListReferenceImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.purge_products.js b/samples/generated/v1/product_search.purge_products.js deleted file mode 100644 index 7cd42dff..00000000 --- a/samples/generated/v1/product_search.purge_products.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1_generated_ProductSearch_PurgeProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Specify which ProductSet contains the Products to be deleted. - */ - // const productSetPurgeConfig = {} - /** - * If delete_orphan_products is true, all Products that are not in any - * ProductSet will be deleted. - */ - // const deleteOrphanProducts = true - /** - * Required. The project and location in which the Products should be deleted. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * The default value is false. Override this value to true to actually perform - * the purge. - */ - // const force = true - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callPurgeProducts() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await visionClient.purgeProducts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callPurgeProducts(); - // [END vision_v1_generated_ProductSearch_PurgeProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.remove_product_from_product_set.js b/samples/generated/v1/product_search.remove_product_from_product_set.js deleted file mode 100644 index 02feca9e..00000000 --- a/samples/generated/v1/product_search.remove_product_from_product_set.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, product) { - // [START vision_v1_generated_ProductSearch_RemoveProductFromProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the ProductSet to modify. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * Required. The resource name for the Product to be removed from this ProductSet. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const product = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callRemoveProductFromProductSet() { - // Construct request - const request = { - name, - product, - }; - - // Run request - const response = await visionClient.removeProductFromProductSet(request); - console.log(response); - } - - callRemoveProductFromProductSet(); - // [END vision_v1_generated_ProductSearch_RemoveProductFromProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.update_product.js b/samples/generated/v1/product_search.update_product.js deleted file mode 100644 index 69391152..00000000 --- a/samples/generated/v1/product_search.update_product.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(product) { - // [START vision_v1_generated_ProductSearch_UpdateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - */ - // const product = {} - /** - * 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`. - */ - // const updateMask = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callUpdateProduct() { - // Construct request - const request = { - product, - }; - - // Run request - const response = await visionClient.updateProduct(request); - console.log(response); - } - - callUpdateProduct(); - // [END vision_v1_generated_ProductSearch_UpdateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/product_search.update_product_set.js b/samples/generated/v1/product_search.update_product_set.js deleted file mode 100644 index 65d4315e..00000000 --- a/samples/generated/v1/product_search.update_product_set.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(productSet) { - // [START vision_v1_generated_ProductSearch_UpdateProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ProductSet resource which replaces the one on the server. - */ - // const productSet = {} - /** - * 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`. - */ - // const updateMask = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callUpdateProductSet() { - // Construct request - const request = { - productSet, - }; - - // Run request - const response = await visionClient.updateProductSet(request); - console.log(response); - } - - callUpdateProductSet(); - // [END vision_v1_generated_ProductSearch_UpdateProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1/snippet_metadata.google.cloud.vision.v1.json b/samples/generated/v1/snippet_metadata.google.cloud.vision.v1.json deleted file mode 100644 index 48341229..00000000 --- a/samples/generated/v1/snippet_metadata.google.cloud.vision.v1.json +++ /dev/null @@ -1,1043 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-vision", - "version": "3.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.vision.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "vision_v1_generated_ImageAnnotator_BatchAnnotateImages_async", - "title": "vision batchAnnotateImages Sample", - "origin": "API_DEFINITION", - "description": " Run image detection and annotation for a batch of images.", - "canonical": true, - "file": "image_annotator.batch_annotate_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1.ImageAnnotator.BatchAnnotateImages", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.BatchAnnotateImagesResponse", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1.ImageAnnotatorClient" - }, - "method": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1.ImageAnnotator.BatchAnnotateImages", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_async", - "title": "vision batchAnnotateFiles Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "image_annotator.batch_annotate_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchAnnotateFiles", - "fullName": "google.cloud.vision.v1.ImageAnnotator.BatchAnnotateFiles", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.BatchAnnotateFilesResponse", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1.ImageAnnotatorClient" - }, - "method": { - "shortName": "BatchAnnotateFiles", - "fullName": "google.cloud.vision.v1.ImageAnnotator.BatchAnnotateFiles", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async", - "title": "vision asyncBatchAnnotateImages Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "image_annotator.async_batch_annotate_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsyncBatchAnnotateImages", - "fullName": "google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateImages", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "output_config", - "type": ".google.cloud.vision.v1.OutputConfig" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1.ImageAnnotatorClient" - }, - "method": { - "shortName": "AsyncBatchAnnotateImages", - "fullName": "google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateImages", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async", - "title": "vision asyncBatchAnnotateFiles Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "image_annotator.async_batch_annotate_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsyncBatchAnnotateFiles", - "fullName": "google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateFiles", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1.ImageAnnotatorClient" - }, - "method": { - "shortName": "AsyncBatchAnnotateFiles", - "fullName": "google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateFiles", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_CreateProductSet_async", - "title": "vision createProductSet Sample", - "origin": "API_DEFINITION", - "description": " Creates and returns a new ProductSet resource. Possible errors: * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.", - "canonical": true, - "file": "product_search.create_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.CreateProductSet", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product_set", - "type": ".google.cloud.vision.v1.ProductSet" - }, - { - "name": "product_set_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "CreateProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.CreateProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_ListProductSets_async", - "title": "vision listProductSets Sample", - "origin": "API_DEFINITION", - "description": " Lists ProductSets in an unspecified order. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.", - "canonical": true, - "file": "product_search.list_product_sets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProductSets", - "fullName": "google.cloud.vision.v1.ProductSearch.ListProductSets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.ListProductSetsResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "ListProductSets", - "fullName": "google.cloud.vision.v1.ProductSearch.ListProductSets", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_GetProductSet_async", - "title": "vision getProductSet Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a ProductSet. Possible errors: * Returns NOT_FOUND if the ProductSet does not exist.", - "canonical": true, - "file": "product_search.get_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.GetProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "GetProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.GetProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_UpdateProductSet_async", - "title": "vision updateProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.update_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.UpdateProductSet", - "async": true, - "parameters": [ - { - "name": "product_set", - "type": ".google.cloud.vision.v1.ProductSet" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.vision.v1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "UpdateProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.UpdateProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_DeleteProductSet_async", - "title": "vision deleteProductSet Sample", - "origin": "API_DEFINITION", - "description": " Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted. The actual image files are not deleted from Google Cloud Storage.", - "canonical": true, - "file": "product_search.delete_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.DeleteProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.DeleteProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_CreateProduct_async", - "title": "vision createProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.create_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.vision.v1.ProductSearch.CreateProduct", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.vision.v1.Product" - }, - { - "name": "product_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.vision.v1.ProductSearch.CreateProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_ListProducts_async", - "title": "vision listProducts Sample", - "origin": "API_DEFINITION", - "description": " Lists products in an unspecified order. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.", - "canonical": true, - "file": "product_search.list_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.vision.v1.ProductSearch.ListProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.ListProductsResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.vision.v1.ProductSearch.ListProducts", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_GetProduct_async", - "title": "vision getProduct Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a Product. Possible errors: * Returns NOT_FOUND if the Product does not exist.", - "canonical": true, - "file": "product_search.get_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.vision.v1.ProductSearch.GetProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.vision.v1.ProductSearch.GetProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_UpdateProduct_async", - "title": "vision updateProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.update_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.vision.v1.ProductSearch.UpdateProduct", - "async": true, - "parameters": [ - { - "name": "product", - "type": ".google.cloud.vision.v1.Product" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.vision.v1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.vision.v1.ProductSearch.UpdateProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_DeleteProduct_async", - "title": "vision deleteProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.delete_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.vision.v1.ProductSearch.DeleteProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.vision.v1.ProductSearch.DeleteProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_CreateReferenceImage_async", - "title": "vision createReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.create_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateReferenceImage", - "fullName": "google.cloud.vision.v1.ProductSearch.CreateReferenceImage", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "reference_image", - "type": ".google.cloud.vision.v1.ReferenceImage" - }, - { - "name": "reference_image_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.ReferenceImage", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "CreateReferenceImage", - "fullName": "google.cloud.vision.v1.ProductSearch.CreateReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_DeleteReferenceImage_async", - "title": "vision deleteReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.delete_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteReferenceImage", - "fullName": "google.cloud.vision.v1.ProductSearch.DeleteReferenceImage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteReferenceImage", - "fullName": "google.cloud.vision.v1.ProductSearch.DeleteReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_ListReferenceImages_async", - "title": "vision listReferenceImages Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.list_reference_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListReferenceImages", - "fullName": "google.cloud.vision.v1.ProductSearch.ListReferenceImages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.ListReferenceImagesResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "ListReferenceImages", - "fullName": "google.cloud.vision.v1.ProductSearch.ListReferenceImages", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_GetReferenceImage_async", - "title": "vision getReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a ReferenceImage. Possible errors: * Returns NOT_FOUND if the specified image does not exist.", - "canonical": true, - "file": "product_search.get_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetReferenceImage", - "fullName": "google.cloud.vision.v1.ProductSearch.GetReferenceImage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.ReferenceImage", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "GetReferenceImage", - "fullName": "google.cloud.vision.v1.ProductSearch.GetReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_AddProductToProductSet_async", - "title": "vision addProductToProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.add_product_to_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddProductToProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.AddProductToProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "AddProductToProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.AddProductToProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_RemoveProductFromProductSet_async", - "title": "vision removeProductFromProductSet Sample", - "origin": "API_DEFINITION", - "description": " Removes a Product from the specified ProductSet.", - "canonical": true, - "file": "product_search.remove_product_from_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveProductFromProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.RemoveProductFromProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "RemoveProductFromProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.RemoveProductFromProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_ListProductsInProductSet_async", - "title": "vision listProductsInProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.list_products_in_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProductsInProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.ListProductsInProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1.ListProductsInProductSetResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "ListProductsInProductSet", - "fullName": "google.cloud.vision.v1.ProductSearch.ListProductsInProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_ImportProductSets_async", - "title": "vision importProductSets Sample", - "origin": "API_DEFINITION", - "description": " 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].", - "canonical": true, - "file": "product_search.import_product_sets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportProductSets", - "fullName": "google.cloud.vision.v1.ProductSearch.ImportProductSets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.vision.v1.ImportProductSetsInputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "ImportProductSets", - "fullName": "google.cloud.vision.v1.ProductSearch.ImportProductSets", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1_generated_ProductSearch_PurgeProducts_async", - "title": "vision purgeProducts Sample", - "origin": "API_DEFINITION", - "description": " 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)", - "canonical": true, - "file": "product_search.purge_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.vision.v1.ProductSearch.PurgeProducts", - "async": true, - "parameters": [ - { - "name": "product_set_purge_config", - "type": ".google.cloud.vision.v1.ProductSetPurgeConfig" - }, - { - "name": "delete_orphan_products", - "type": "TYPE_BOOL" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1.ProductSearchClient" - }, - "method": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.vision.v1.ProductSearch.PurgeProducts", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1.ProductSearch" - } - } - } - } - ] -} \ No newline at end of file diff --git a/samples/generated/v1p1beta1/image_annotator.batch_annotate_images.js b/samples/generated/v1p1beta1/image_annotator.batch_annotate_images.js deleted file mode 100644 index 04a62e5d..00000000 --- a/samples/generated/v1p1beta1/image_annotator.batch_annotate_images.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1p1beta1_generated_ImageAnnotator_BatchAnnotateImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual image annotation requests for this batch. - */ - // const requests = 1234 - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p1beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callBatchAnnotateImages() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await visionClient.batchAnnotateImages(request); - console.log(response); - } - - callBatchAnnotateImages(); - // [END vision_v1p1beta1_generated_ImageAnnotator_BatchAnnotateImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p1beta1/snippet_metadata.google.cloud.vision.v1p1beta1.json b/samples/generated/v1p1beta1/snippet_metadata.google.cloud.vision.v1p1beta1.json deleted file mode 100644 index 1c78660f..00000000 --- a/samples/generated/v1p1beta1/snippet_metadata.google.cloud.vision.v1p1beta1.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-vision", - "version": "3.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.vision.v1p1beta1", - "version": "v1p1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "vision_v1p1beta1_generated_ImageAnnotator_BatchAnnotateImages_async", - "title": "vision batchAnnotateImages Sample", - "origin": "API_DEFINITION", - "description": " Run image detection and annotation for a batch of images.", - "canonical": true, - "file": "image_annotator.batch_annotate_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1p1beta1.ImageAnnotator.BatchAnnotateImages", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p1beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1p1beta1.ImageAnnotator.BatchAnnotateImages", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p1beta1.ImageAnnotator" - } - } - } - } - ] -} \ No newline at end of file diff --git a/samples/generated/v1p2beta1/image_annotator.async_batch_annotate_files.js b/samples/generated/v1p2beta1/image_annotator.async_batch_annotate_files.js deleted file mode 100644 index 5159cebe..00000000 --- a/samples/generated/v1p2beta1/image_annotator.async_batch_annotate_files.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1p2beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual async file annotation requests for this batch. - */ - // const requests = 1234 - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p2beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callAsyncBatchAnnotateFiles() { - // Construct request - const request = { - requests, - }; - - // Run request - const [operation] = await visionClient.asyncBatchAnnotateFiles(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAsyncBatchAnnotateFiles(); - // [END vision_v1p2beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p2beta1/image_annotator.batch_annotate_images.js b/samples/generated/v1p2beta1/image_annotator.batch_annotate_images.js deleted file mode 100644 index 21f5fe4b..00000000 --- a/samples/generated/v1p2beta1/image_annotator.batch_annotate_images.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1p2beta1_generated_ImageAnnotator_BatchAnnotateImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual image annotation requests for this batch. - */ - // const requests = 1234 - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p2beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callBatchAnnotateImages() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await visionClient.batchAnnotateImages(request); - console.log(response); - } - - callBatchAnnotateImages(); - // [END vision_v1p2beta1_generated_ImageAnnotator_BatchAnnotateImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p2beta1/snippet_metadata.google.cloud.vision.v1p2beta1.json b/samples/generated/v1p2beta1/snippet_metadata.google.cloud.vision.v1p2beta1.json deleted file mode 100644 index 874d4eeb..00000000 --- a/samples/generated/v1p2beta1/snippet_metadata.google.cloud.vision.v1p2beta1.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-vision", - "version": "3.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.vision.v1p2beta1", - "version": "v1p2beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "vision_v1p2beta1_generated_ImageAnnotator_BatchAnnotateImages_async", - "title": "vision batchAnnotateImages Sample", - "origin": "API_DEFINITION", - "description": " Run image detection and annotation for a batch of images.", - "canonical": true, - "file": "image_annotator.batch_annotate_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator.BatchAnnotateImages", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator.BatchAnnotateImages", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1p2beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async", - "title": "vision asyncBatchAnnotateFiles Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "image_annotator.async_batch_annotate_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsyncBatchAnnotateFiles", - "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator.AsyncBatchAnnotateFiles", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "AsyncBatchAnnotateFiles", - "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator.AsyncBatchAnnotateFiles", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator" - } - } - } - } - ] -} \ No newline at end of file diff --git a/samples/generated/v1p3beta1/image_annotator.async_batch_annotate_files.js b/samples/generated/v1p3beta1/image_annotator.async_batch_annotate_files.js deleted file mode 100644 index ad289491..00000000 --- a/samples/generated/v1p3beta1/image_annotator.async_batch_annotate_files.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1p3beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual async file annotation requests for this batch. - */ - // const requests = 1234 - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callAsyncBatchAnnotateFiles() { - // Construct request - const request = { - requests, - }; - - // Run request - const [operation] = await visionClient.asyncBatchAnnotateFiles(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAsyncBatchAnnotateFiles(); - // [END vision_v1p3beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/image_annotator.batch_annotate_images.js b/samples/generated/v1p3beta1/image_annotator.batch_annotate_images.js deleted file mode 100644 index 50c2ee9c..00000000 --- a/samples/generated/v1p3beta1/image_annotator.batch_annotate_images.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1p3beta1_generated_ImageAnnotator_BatchAnnotateImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Individual image annotation requests for this batch. - */ - // const requests = 1234 - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callBatchAnnotateImages() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await visionClient.batchAnnotateImages(request); - console.log(response); - } - - callBatchAnnotateImages(); - // [END vision_v1p3beta1_generated_ImageAnnotator_BatchAnnotateImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.add_product_to_product_set.js b/samples/generated/v1p3beta1/product_search.add_product_to_product_set.js deleted file mode 100644 index 59fb5512..00000000 --- a/samples/generated/v1p3beta1/product_search.add_product_to_product_set.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, product) { - // [START vision_v1p3beta1_generated_ProductSearch_AddProductToProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the ProductSet to modify. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * Required. The resource name for the Product to be added to this ProductSet. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const product = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callAddProductToProductSet() { - // Construct request - const request = { - name, - product, - }; - - // Run request - const response = await visionClient.addProductToProductSet(request); - console.log(response); - } - - callAddProductToProductSet(); - // [END vision_v1p3beta1_generated_ProductSearch_AddProductToProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.create_product.js b/samples/generated/v1p3beta1/product_search.create_product.js deleted file mode 100644 index cae01deb..00000000 --- a/samples/generated/v1p3beta1/product_search.create_product.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, product) { - // [START vision_v1p3beta1_generated_ProductSearch_CreateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the Product should be created. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The product to create. - */ - // const product = {} - /** - * 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 `/`. - */ - // const productId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateProduct() { - // Construct request - const request = { - parent, - product, - }; - - // Run request - const response = await visionClient.createProduct(request); - console.log(response); - } - - callCreateProduct(); - // [END vision_v1p3beta1_generated_ProductSearch_CreateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.create_product_set.js b/samples/generated/v1p3beta1/product_search.create_product_set.js deleted file mode 100644 index 1c056450..00000000 --- a/samples/generated/v1p3beta1/product_search.create_product_set.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, productSet) { - // [START vision_v1p3beta1_generated_ProductSearch_CreateProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the ProductSet should be created. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The ProductSet to create. - */ - // const productSet = {} - /** - * 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 `/`. - */ - // const productSetId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateProductSet() { - // Construct request - const request = { - parent, - productSet, - }; - - // Run request - const response = await visionClient.createProductSet(request); - console.log(response); - } - - callCreateProductSet(); - // [END vision_v1p3beta1_generated_ProductSearch_CreateProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.create_reference_image.js b/samples/generated/v1p3beta1/product_search.create_reference_image.js deleted file mode 100644 index 6842f0d6..00000000 --- a/samples/generated/v1p3beta1/product_search.create_reference_image.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, referenceImage) { - // [START vision_v1p3beta1_generated_ProductSearch_CreateReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the product in which to create the reference image. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - */ - // const parent = 'abc123' - /** - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - */ - // const referenceImage = {} - /** - * 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 `/`. - */ - // const referenceImageId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateReferenceImage() { - // Construct request - const request = { - parent, - referenceImage, - }; - - // Run request - const response = await visionClient.createReferenceImage(request); - console.log(response); - } - - callCreateReferenceImage(); - // [END vision_v1p3beta1_generated_ProductSearch_CreateReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.delete_product.js b/samples/generated/v1p3beta1/product_search.delete_product.js deleted file mode 100644 index 0874ac56..00000000 --- a/samples/generated/v1p3beta1/product_search.delete_product.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p3beta1_generated_ProductSearch_DeleteProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of product to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteProduct(request); - console.log(response); - } - - callDeleteProduct(); - // [END vision_v1p3beta1_generated_ProductSearch_DeleteProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.delete_product_set.js b/samples/generated/v1p3beta1/product_search.delete_product_set.js deleted file mode 100644 index 0c2c1b22..00000000 --- a/samples/generated/v1p3beta1/product_search.delete_product_set.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p3beta1_generated_ProductSearch_DeleteProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the ProductSet to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteProductSet(request); - console.log(response); - } - - callDeleteProductSet(); - // [END vision_v1p3beta1_generated_ProductSearch_DeleteProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.delete_reference_image.js b/samples/generated/v1p3beta1/product_search.delete_reference_image.js deleted file mode 100644 index 428cb5c5..00000000 --- a/samples/generated/v1p3beta1/product_search.delete_reference_image.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p3beta1_generated_ProductSearch_DeleteReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the reference image to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteReferenceImage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteReferenceImage(request); - console.log(response); - } - - callDeleteReferenceImage(); - // [END vision_v1p3beta1_generated_ProductSearch_DeleteReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.get_product.js b/samples/generated/v1p3beta1/product_search.get_product.js deleted file mode 100644 index e567ea01..00000000 --- a/samples/generated/v1p3beta1/product_search.get_product.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p3beta1_generated_ProductSearch_GetProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the Product to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getProduct(request); - console.log(response); - } - - callGetProduct(); - // [END vision_v1p3beta1_generated_ProductSearch_GetProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.get_product_set.js b/samples/generated/v1p3beta1/product_search.get_product_set.js deleted file mode 100644 index 6172705b..00000000 --- a/samples/generated/v1p3beta1/product_search.get_product_set.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p3beta1_generated_ProductSearch_GetProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the ProductSet to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getProductSet(request); - console.log(response); - } - - callGetProductSet(); - // [END vision_v1p3beta1_generated_ProductSearch_GetProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.get_reference_image.js b/samples/generated/v1p3beta1/product_search.get_reference_image.js deleted file mode 100644 index 23a706fb..00000000 --- a/samples/generated/v1p3beta1/product_search.get_reference_image.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p3beta1_generated_ProductSearch_GetReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ReferenceImage to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetReferenceImage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getReferenceImage(request); - console.log(response); - } - - callGetReferenceImage(); - // [END vision_v1p3beta1_generated_ProductSearch_GetReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.import_product_sets.js b/samples/generated/v1p3beta1/product_search.import_product_sets.js deleted file mode 100644 index abae1194..00000000 --- a/samples/generated/v1p3beta1/product_search.import_product_sets.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START vision_v1p3beta1_generated_ProductSearch_ImportProductSets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the ProductSets should be imported. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The input content for the list of requests. - */ - // const inputConfig = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callImportProductSets() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await visionClient.importProductSets(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportProductSets(); - // [END vision_v1p3beta1_generated_ProductSearch_ImportProductSets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.list_product_sets.js b/samples/generated/v1p3beta1/product_search.list_product_sets.js deleted file mode 100644 index a79e216e..00000000 --- a/samples/generated/v1p3beta1/product_search.list_product_sets.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1p3beta1_generated_ProductSearch_ListProductSets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project from which ProductSets should be listed. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProductSets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listProductSetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProductSets(); - // [END vision_v1p3beta1_generated_ProductSearch_ListProductSets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.list_products.js b/samples/generated/v1p3beta1/product_search.list_products.js deleted file mode 100644 index 2cf281d3..00000000 --- a/samples/generated/v1p3beta1/product_search.list_products.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1p3beta1_generated_ProductSearch_ListProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project OR ProductSet from which Products should be listed. - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProducts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listProductsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProducts(); - // [END vision_v1p3beta1_generated_ProductSearch_ListProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.list_products_in_product_set.js b/samples/generated/v1p3beta1/product_search.list_products_in_product_set.js deleted file mode 100644 index db185779..00000000 --- a/samples/generated/v1p3beta1/product_search.list_products_in_product_set.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p3beta1_generated_ProductSearch_ListProductsInProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ProductSet resource for which to retrieve Products. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProductsInProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await visionClient.listProductsInProductSetAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProductsInProductSet(); - // [END vision_v1p3beta1_generated_ProductSearch_ListProductsInProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.list_reference_images.js b/samples/generated/v1p3beta1/product_search.list_reference_images.js deleted file mode 100644 index 8f9a281b..00000000 --- a/samples/generated/v1p3beta1/product_search.list_reference_images.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1p3beta1_generated_ProductSearch_ListReferenceImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the product containing the reference images. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * 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. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListReferenceImages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listReferenceImagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListReferenceImages(); - // [END vision_v1p3beta1_generated_ProductSearch_ListReferenceImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.remove_product_from_product_set.js b/samples/generated/v1p3beta1/product_search.remove_product_from_product_set.js deleted file mode 100644 index f010803e..00000000 --- a/samples/generated/v1p3beta1/product_search.remove_product_from_product_set.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, product) { - // [START vision_v1p3beta1_generated_ProductSearch_RemoveProductFromProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the ProductSet to modify. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * Required. The resource name for the Product to be removed from this ProductSet. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const product = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callRemoveProductFromProductSet() { - // Construct request - const request = { - name, - product, - }; - - // Run request - const response = await visionClient.removeProductFromProductSet(request); - console.log(response); - } - - callRemoveProductFromProductSet(); - // [END vision_v1p3beta1_generated_ProductSearch_RemoveProductFromProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.update_product.js b/samples/generated/v1p3beta1/product_search.update_product.js deleted file mode 100644 index dcc93df7..00000000 --- a/samples/generated/v1p3beta1/product_search.update_product.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(product) { - // [START vision_v1p3beta1_generated_ProductSearch_UpdateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - */ - // const product = {} - /** - * 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`. - */ - // const updateMask = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callUpdateProduct() { - // Construct request - const request = { - product, - }; - - // Run request - const response = await visionClient.updateProduct(request); - console.log(response); - } - - callUpdateProduct(); - // [END vision_v1p3beta1_generated_ProductSearch_UpdateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/product_search.update_product_set.js b/samples/generated/v1p3beta1/product_search.update_product_set.js deleted file mode 100644 index 59b2ffc0..00000000 --- a/samples/generated/v1p3beta1/product_search.update_product_set.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(productSet) { - // [START vision_v1p3beta1_generated_ProductSearch_UpdateProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ProductSet resource which replaces the one on the server. - */ - // const productSet = {} - /** - * 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`. - */ - // const updateMask = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p3beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callUpdateProductSet() { - // Construct request - const request = { - productSet, - }; - - // Run request - const response = await visionClient.updateProductSet(request); - console.log(response); - } - - callUpdateProductSet(); - // [END vision_v1p3beta1_generated_ProductSearch_UpdateProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p3beta1/snippet_metadata.google.cloud.vision.v1p3beta1.json b/samples/generated/v1p3beta1/snippet_metadata.google.cloud.vision.v1p3beta1.json deleted file mode 100644 index 2f45d920..00000000 --- a/samples/generated/v1p3beta1/snippet_metadata.google.cloud.vision.v1p3beta1.json +++ /dev/null @@ -1,891 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-vision", - "version": "3.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.vision.v1p3beta1", - "version": "v1p3beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "vision_v1p3beta1_generated_ImageAnnotator_BatchAnnotateImages_async", - "title": "vision batchAnnotateImages Sample", - "origin": "API_DEFINITION", - "description": " Run image detection and annotation for a batch of images.", - "canonical": true, - "file": "image_annotator.batch_annotate_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator.BatchAnnotateImages", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator.BatchAnnotateImages", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async", - "title": "vision asyncBatchAnnotateFiles Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "image_annotator.async_batch_annotate_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsyncBatchAnnotateFiles", - "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator.AsyncBatchAnnotateFiles", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "AsyncBatchAnnotateFiles", - "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator.AsyncBatchAnnotateFiles", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateProductSet_async", - "title": "vision createProductSet Sample", - "origin": "API_DEFINITION", - "description": " Creates and returns a new ProductSet resource. Possible errors: * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.", - "canonical": true, - "file": "product_search.create_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateProductSet", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product_set", - "type": ".google.cloud.vision.v1p3beta1.ProductSet" - }, - { - "name": "product_set_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "CreateProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProductSets_async", - "title": "vision listProductSets Sample", - "origin": "API_DEFINITION", - "description": " Lists ProductSets in an unspecified order. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.", - "canonical": true, - "file": "product_search.list_product_sets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProductSets", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProductSets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ListProductSetsResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "ListProductSets", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProductSets", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetProductSet_async", - "title": "vision getProductSet Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a ProductSet. Possible errors: * Returns NOT_FOUND if the ProductSet does not exist.", - "canonical": true, - "file": "product_search.get_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "GetProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_UpdateProductSet_async", - "title": "vision updateProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.update_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.UpdateProductSet", - "async": true, - "parameters": [ - { - "name": "product_set", - "type": ".google.cloud.vision.v1p3beta1.ProductSet" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "UpdateProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.UpdateProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteProductSet_async", - "title": "vision deleteProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.delete_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateProduct_async", - "title": "vision createProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.create_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateProduct", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.vision.v1p3beta1.Product" - }, - { - "name": "product_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProducts_async", - "title": "vision listProducts Sample", - "origin": "API_DEFINITION", - "description": " Lists products in an unspecified order. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.", - "canonical": true, - "file": "product_search.list_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ListProductsResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProducts", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetProduct_async", - "title": "vision getProduct Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a Product. Possible errors: * Returns NOT_FOUND if the Product does not exist.", - "canonical": true, - "file": "product_search.get_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_UpdateProduct_async", - "title": "vision updateProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.update_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.UpdateProduct", - "async": true, - "parameters": [ - { - "name": "product", - "type": ".google.cloud.vision.v1p3beta1.Product" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.UpdateProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteProduct_async", - "title": "vision deleteProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.delete_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateReferenceImage_async", - "title": "vision createReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.create_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateReferenceImage", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateReferenceImage", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "reference_image", - "type": ".google.cloud.vision.v1p3beta1.ReferenceImage" - }, - { - "name": "reference_image_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ReferenceImage", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "CreateReferenceImage", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteReferenceImage_async", - "title": "vision deleteReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.delete_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteReferenceImage", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteReferenceImage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteReferenceImage", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListReferenceImages_async", - "title": "vision listReferenceImages Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.list_reference_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListReferenceImages", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListReferenceImages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ListReferenceImagesResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "ListReferenceImages", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListReferenceImages", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetReferenceImage_async", - "title": "vision getReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a ReferenceImage. Possible errors: * Returns NOT_FOUND if the specified image does not exist.", - "canonical": true, - "file": "product_search.get_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetReferenceImage", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetReferenceImage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ReferenceImage", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "GetReferenceImage", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_AddProductToProductSet_async", - "title": "vision addProductToProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.add_product_to_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddProductToProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.AddProductToProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "AddProductToProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.AddProductToProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_RemoveProductFromProductSet_async", - "title": "vision removeProductFromProductSet Sample", - "origin": "API_DEFINITION", - "description": " Removes a Product from the specified ProductSet. Possible errors: * Returns NOT_FOUND If the Product is not found under the ProductSet.", - "canonical": true, - "file": "product_search.remove_product_from_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveProductFromProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.RemoveProductFromProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "RemoveProductFromProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.RemoveProductFromProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProductsInProductSet_async", - "title": "vision listProductsInProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.list_products_in_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProductsInProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProductsInProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "ListProductsInProductSet", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProductsInProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p3beta1_generated_ProductSearch_ImportProductSets_async", - "title": "vision importProductSets Sample", - "origin": "API_DEFINITION", - "description": " 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].", - "canonical": true, - "file": "product_search.import_product_sets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportProductSets", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ImportProductSets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearchClient" - }, - "method": { - "shortName": "ImportProductSets", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ImportProductSets", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p3beta1.ProductSearch" - } - } - } - } - ] -} \ No newline at end of file diff --git a/samples/generated/v1p4beta1/image_annotator.async_batch_annotate_files.js b/samples/generated/v1p4beta1/image_annotator.async_batch_annotate_files.js deleted file mode 100644 index 4fca75d9..00000000 --- a/samples/generated/v1p4beta1/image_annotator.async_batch_annotate_files.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual async file annotation requests for this batch. - */ - // const requests = 1234 - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callAsyncBatchAnnotateFiles() { - // Construct request - const request = { - requests, - }; - - // Run request - const [operation] = await visionClient.asyncBatchAnnotateFiles(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAsyncBatchAnnotateFiles(); - // [END vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/image_annotator.async_batch_annotate_images.js b/samples/generated/v1p4beta1/image_annotator.async_batch_annotate_images.js deleted file mode 100644 index d724c61a..00000000 --- a/samples/generated/v1p4beta1/image_annotator.async_batch_annotate_images.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests, outputConfig) { - // [START vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual image annotation requests for this batch. - */ - // const requests = 1234 - /** - * Required. The desired output location and metadata (e.g. format). - */ - // const outputConfig = {} - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callAsyncBatchAnnotateImages() { - // Construct request - const request = { - requests, - outputConfig, - }; - - // Run request - const [operation] = await visionClient.asyncBatchAnnotateImages(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAsyncBatchAnnotateImages(); - // [END vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/image_annotator.batch_annotate_files.js b/samples/generated/v1p4beta1/image_annotator.batch_annotate_files.js deleted file mode 100644 index b0f97db6..00000000 --- a/samples/generated/v1p4beta1/image_annotator.batch_annotate_files.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateFiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The list of file annotation requests. Right now we support only - * one AnnotateFileRequest in BatchAnnotateFilesRequest. - */ - // const requests = 1234 - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callBatchAnnotateFiles() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await visionClient.batchAnnotateFiles(request); - console.log(response); - } - - callBatchAnnotateFiles(); - // [END vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateFiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/image_annotator.batch_annotate_images.js b/samples/generated/v1p4beta1/image_annotator.batch_annotate_images.js deleted file mode 100644 index e6a52d75..00000000 --- a/samples/generated/v1p4beta1/image_annotator.batch_annotate_images.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(requests) { - // [START vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Individual image annotation requests for this batch. - */ - // const requests = 1234 - - // Imports the Vision library - const {ImageAnnotatorClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ImageAnnotatorClient(); - - async function callBatchAnnotateImages() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await visionClient.batchAnnotateImages(request); - console.log(response); - } - - callBatchAnnotateImages(); - // [END vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.add_product_to_product_set.js b/samples/generated/v1p4beta1/product_search.add_product_to_product_set.js deleted file mode 100644 index b05bc5af..00000000 --- a/samples/generated/v1p4beta1/product_search.add_product_to_product_set.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, product) { - // [START vision_v1p4beta1_generated_ProductSearch_AddProductToProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the ProductSet to modify. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * Required. The resource name for the Product to be added to this ProductSet. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const product = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callAddProductToProductSet() { - // Construct request - const request = { - name, - product, - }; - - // Run request - const response = await visionClient.addProductToProductSet(request); - console.log(response); - } - - callAddProductToProductSet(); - // [END vision_v1p4beta1_generated_ProductSearch_AddProductToProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.create_product.js b/samples/generated/v1p4beta1/product_search.create_product.js deleted file mode 100644 index 3d7a4215..00000000 --- a/samples/generated/v1p4beta1/product_search.create_product.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, product) { - // [START vision_v1p4beta1_generated_ProductSearch_CreateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the Product should be created. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The product to create. - */ - // const product = {} - /** - * 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 `/`. - */ - // const productId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateProduct() { - // Construct request - const request = { - parent, - product, - }; - - // Run request - const response = await visionClient.createProduct(request); - console.log(response); - } - - callCreateProduct(); - // [END vision_v1p4beta1_generated_ProductSearch_CreateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.create_product_set.js b/samples/generated/v1p4beta1/product_search.create_product_set.js deleted file mode 100644 index 39e0b6d4..00000000 --- a/samples/generated/v1p4beta1/product_search.create_product_set.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, productSet) { - // [START vision_v1p4beta1_generated_ProductSearch_CreateProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the ProductSet should be created. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The ProductSet to create. - */ - // const productSet = {} - /** - * 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 `/`. - */ - // const productSetId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateProductSet() { - // Construct request - const request = { - parent, - productSet, - }; - - // Run request - const response = await visionClient.createProductSet(request); - console.log(response); - } - - callCreateProductSet(); - // [END vision_v1p4beta1_generated_ProductSearch_CreateProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.create_reference_image.js b/samples/generated/v1p4beta1/product_search.create_reference_image.js deleted file mode 100644 index 4234bac5..00000000 --- a/samples/generated/v1p4beta1/product_search.create_reference_image.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, referenceImage) { - // [START vision_v1p4beta1_generated_ProductSearch_CreateReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the product in which to create the reference - * image. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - */ - // const parent = 'abc123' - /** - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - */ - // const referenceImage = {} - /** - * 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 `/`. - */ - // const referenceImageId = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callCreateReferenceImage() { - // Construct request - const request = { - parent, - referenceImage, - }; - - // Run request - const response = await visionClient.createReferenceImage(request); - console.log(response); - } - - callCreateReferenceImage(); - // [END vision_v1p4beta1_generated_ProductSearch_CreateReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.delete_product.js b/samples/generated/v1p4beta1/product_search.delete_product.js deleted file mode 100644 index 77a59a20..00000000 --- a/samples/generated/v1p4beta1/product_search.delete_product.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p4beta1_generated_ProductSearch_DeleteProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of product to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteProduct(request); - console.log(response); - } - - callDeleteProduct(); - // [END vision_v1p4beta1_generated_ProductSearch_DeleteProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.delete_product_set.js b/samples/generated/v1p4beta1/product_search.delete_product_set.js deleted file mode 100644 index 47366aff..00000000 --- a/samples/generated/v1p4beta1/product_search.delete_product_set.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p4beta1_generated_ProductSearch_DeleteProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the ProductSet to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteProductSet(request); - console.log(response); - } - - callDeleteProductSet(); - // [END vision_v1p4beta1_generated_ProductSearch_DeleteProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.delete_reference_image.js b/samples/generated/v1p4beta1/product_search.delete_reference_image.js deleted file mode 100644 index ba8d84e8..00000000 --- a/samples/generated/v1p4beta1/product_search.delete_reference_image.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p4beta1_generated_ProductSearch_DeleteReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the reference image to delete. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callDeleteReferenceImage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.deleteReferenceImage(request); - console.log(response); - } - - callDeleteReferenceImage(); - // [END vision_v1p4beta1_generated_ProductSearch_DeleteReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.get_product.js b/samples/generated/v1p4beta1/product_search.get_product.js deleted file mode 100644 index d25228dc..00000000 --- a/samples/generated/v1p4beta1/product_search.get_product.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p4beta1_generated_ProductSearch_GetProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the Product to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getProduct(request); - console.log(response); - } - - callGetProduct(); - // [END vision_v1p4beta1_generated_ProductSearch_GetProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.get_product_set.js b/samples/generated/v1p4beta1/product_search.get_product_set.js deleted file mode 100644 index fb9617e5..00000000 --- a/samples/generated/v1p4beta1/product_search.get_product_set.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p4beta1_generated_ProductSearch_GetProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the ProductSet to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getProductSet(request); - console.log(response); - } - - callGetProductSet(); - // [END vision_v1p4beta1_generated_ProductSearch_GetProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.get_reference_image.js b/samples/generated/v1p4beta1/product_search.get_reference_image.js deleted file mode 100644 index 61727ded..00000000 --- a/samples/generated/v1p4beta1/product_search.get_reference_image.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p4beta1_generated_ProductSearch_GetReferenceImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ReferenceImage to get. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - */ - // const name = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callGetReferenceImage() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await visionClient.getReferenceImage(request); - console.log(response); - } - - callGetReferenceImage(); - // [END vision_v1p4beta1_generated_ProductSearch_GetReferenceImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.import_product_sets.js b/samples/generated/v1p4beta1/product_search.import_product_sets.js deleted file mode 100644 index d59394fb..00000000 --- a/samples/generated/v1p4beta1/product_search.import_product_sets.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START vision_v1p4beta1_generated_ProductSearch_ImportProductSets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which the ProductSets should be imported. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * Required. The input content for the list of requests. - */ - // const inputConfig = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callImportProductSets() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await visionClient.importProductSets(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportProductSets(); - // [END vision_v1p4beta1_generated_ProductSearch_ImportProductSets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.list_product_sets.js b/samples/generated/v1p4beta1/product_search.list_product_sets.js deleted file mode 100644 index 07c3a811..00000000 --- a/samples/generated/v1p4beta1/product_search.list_product_sets.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1p4beta1_generated_ProductSearch_ListProductSets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project from which ProductSets should be listed. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProductSets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listProductSetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProductSets(); - // [END vision_v1p4beta1_generated_ProductSearch_ListProductSets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.list_products.js b/samples/generated/v1p4beta1/product_search.list_products.js deleted file mode 100644 index 50aaa67a..00000000 --- a/samples/generated/v1p4beta1/product_search.list_products.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1p4beta1_generated_ProductSearch_ListProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project OR ProductSet from which Products should be listed. - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProducts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listProductsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProducts(); - // [END vision_v1p4beta1_generated_ProductSearch_ListProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.list_products_in_product_set.js b/samples/generated/v1p4beta1/product_search.list_products_in_product_set.js deleted file mode 100644 index 402c7019..00000000 --- a/samples/generated/v1p4beta1/product_search.list_products_in_product_set.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START vision_v1p4beta1_generated_ProductSearch_ListProductsInProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ProductSet resource for which to retrieve Products. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * The next_page_token returned from a previous List request, if any. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListProductsInProductSet() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await visionClient.listProductsInProductSetAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProductsInProductSet(); - // [END vision_v1p4beta1_generated_ProductSearch_ListProductsInProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.list_reference_images.js b/samples/generated/v1p4beta1/product_search.list_reference_images.js deleted file mode 100644 index 376272fc..00000000 --- a/samples/generated/v1p4beta1/product_search.list_reference_images.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1p4beta1_generated_ProductSearch_ListReferenceImages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the product containing the reference images. - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. Default 10, maximum 100. - */ - // const pageSize = 1234 - /** - * 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. - */ - // const pageToken = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callListReferenceImages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await visionClient.listReferenceImagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListReferenceImages(); - // [END vision_v1p4beta1_generated_ProductSearch_ListReferenceImages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.purge_products.js b/samples/generated/v1p4beta1/product_search.purge_products.js deleted file mode 100644 index 30d93c0c..00000000 --- a/samples/generated/v1p4beta1/product_search.purge_products.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START vision_v1p4beta1_generated_ProductSearch_PurgeProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Specify which ProductSet contains the Products to be deleted. - */ - // const productSetPurgeConfig = {} - /** - * If delete_orphan_products is true, all Products that are not in any - * ProductSet will be deleted. - */ - // const deleteOrphanProducts = true - /** - * Required. The project and location in which the Products should be deleted. - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - */ - // const parent = 'abc123' - /** - * The default value is false. Override this value to true to actually perform - * the purge. - */ - // const force = true - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callPurgeProducts() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await visionClient.purgeProducts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callPurgeProducts(); - // [END vision_v1p4beta1_generated_ProductSearch_PurgeProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.remove_product_from_product_set.js b/samples/generated/v1p4beta1/product_search.remove_product_from_product_set.js deleted file mode 100644 index dd2c2d1b..00000000 --- a/samples/generated/v1p4beta1/product_search.remove_product_from_product_set.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, product) { - // [START vision_v1p4beta1_generated_ProductSearch_RemoveProductFromProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the ProductSet to modify. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - */ - // const name = 'abc123' - /** - * Required. The resource name for the Product to be removed from this - * ProductSet. - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - */ - // const product = 'abc123' - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callRemoveProductFromProductSet() { - // Construct request - const request = { - name, - product, - }; - - // Run request - const response = await visionClient.removeProductFromProductSet(request); - console.log(response); - } - - callRemoveProductFromProductSet(); - // [END vision_v1p4beta1_generated_ProductSearch_RemoveProductFromProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.update_product.js b/samples/generated/v1p4beta1/product_search.update_product.js deleted file mode 100644 index 5e385c1c..00000000 --- a/samples/generated/v1p4beta1/product_search.update_product.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(product) { - // [START vision_v1p4beta1_generated_ProductSearch_UpdateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - */ - // const product = {} - /** - * 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`. - */ - // const updateMask = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callUpdateProduct() { - // Construct request - const request = { - product, - }; - - // Run request - const response = await visionClient.updateProduct(request); - console.log(response); - } - - callUpdateProduct(); - // [END vision_v1p4beta1_generated_ProductSearch_UpdateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/product_search.update_product_set.js b/samples/generated/v1p4beta1/product_search.update_product_set.js deleted file mode 100644 index 66ed5196..00000000 --- a/samples/generated/v1p4beta1/product_search.update_product_set.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(productSet) { - // [START vision_v1p4beta1_generated_ProductSearch_UpdateProductSet_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ProductSet resource which replaces the one on the server. - */ - // const productSet = {} - /** - * 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`. - */ - // const updateMask = {} - - // Imports the Vision library - const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1; - - // Instantiates a client - const visionClient = new ProductSearchClient(); - - async function callUpdateProductSet() { - // Construct request - const request = { - productSet, - }; - - // Run request - const response = await visionClient.updateProductSet(request); - console.log(response); - } - - callUpdateProductSet(); - // [END vision_v1p4beta1_generated_ProductSearch_UpdateProductSet_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/samples/generated/v1p4beta1/snippet_metadata.google.cloud.vision.v1p4beta1.json b/samples/generated/v1p4beta1/snippet_metadata.google.cloud.vision.v1p4beta1.json deleted file mode 100644 index 837e99e5..00000000 --- a/samples/generated/v1p4beta1/snippet_metadata.google.cloud.vision.v1p4beta1.json +++ /dev/null @@ -1,1027 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-vision", - "version": "3.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.vision.v1p4beta1", - "version": "v1p4beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateImages_async", - "title": "vision batchAnnotateImages Sample", - "origin": "API_DEFINITION", - "description": " Run image detection and annotation for a batch of images.", - "canonical": true, - "file": "image_annotator.batch_annotate_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateImages", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "BatchAnnotateImages", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateImages", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateFiles_async", - "title": "vision batchAnnotateFiles Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "image_annotator.batch_annotate_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchAnnotateFiles", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateFiles", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "BatchAnnotateFiles", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateFiles", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async", - "title": "vision asyncBatchAnnotateImages Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "image_annotator.async_batch_annotate_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsyncBatchAnnotateImages", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImages", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "output_config", - "type": ".google.cloud.vision.v1p4beta1.OutputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "AsyncBatchAnnotateImages", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImages", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async", - "title": "vision asyncBatchAnnotateFiles Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "image_annotator.async_batch_annotate_files.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsyncBatchAnnotateFiles", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFiles", - "async": true, - "parameters": [ - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ImageAnnotatorClient", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotatorClient" - }, - "method": { - "shortName": "AsyncBatchAnnotateFiles", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFiles", - "service": { - "shortName": "ImageAnnotator", - "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateProductSet_async", - "title": "vision createProductSet Sample", - "origin": "API_DEFINITION", - "description": " Creates and returns a new ProductSet resource. Possible errors: * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.", - "canonical": true, - "file": "product_search.create_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateProductSet", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product_set", - "type": ".google.cloud.vision.v1p4beta1.ProductSet" - }, - { - "name": "product_set_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "CreateProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProductSets_async", - "title": "vision listProductSets Sample", - "origin": "API_DEFINITION", - "description": " Lists ProductSets in an unspecified order. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.", - "canonical": true, - "file": "product_search.list_product_sets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProductSets", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProductSets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ListProductSetsResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "ListProductSets", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProductSets", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetProductSet_async", - "title": "vision getProductSet Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a ProductSet. Possible errors: * Returns NOT_FOUND if the ProductSet does not exist.", - "canonical": true, - "file": "product_search.get_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "GetProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_UpdateProductSet_async", - "title": "vision updateProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.update_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.UpdateProductSet", - "async": true, - "parameters": [ - { - "name": "product_set", - "type": ".google.cloud.vision.v1p4beta1.ProductSet" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ProductSet", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "UpdateProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.UpdateProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteProductSet_async", - "title": "vision deleteProductSet Sample", - "origin": "API_DEFINITION", - "description": " Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted. The actual image files are not deleted from Google Cloud Storage.", - "canonical": true, - "file": "product_search.delete_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateProduct_async", - "title": "vision createProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.create_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateProduct", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.vision.v1p4beta1.Product" - }, - { - "name": "product_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProducts_async", - "title": "vision listProducts Sample", - "origin": "API_DEFINITION", - "description": " Lists products in an unspecified order. Possible errors: * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.", - "canonical": true, - "file": "product_search.list_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ListProductsResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProducts", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetProduct_async", - "title": "vision getProduct Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a Product. Possible errors: * Returns NOT_FOUND if the Product does not exist.", - "canonical": true, - "file": "product_search.get_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_UpdateProduct_async", - "title": "vision updateProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.update_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.UpdateProduct", - "async": true, - "parameters": [ - { - "name": "product", - "type": ".google.cloud.vision.v1p4beta1.Product" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.Product", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.UpdateProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteProduct_async", - "title": "vision deleteProduct Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.delete_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteProduct", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateReferenceImage_async", - "title": "vision createReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.create_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateReferenceImage", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateReferenceImage", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "reference_image", - "type": ".google.cloud.vision.v1p4beta1.ReferenceImage" - }, - { - "name": "reference_image_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ReferenceImage", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "CreateReferenceImage", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteReferenceImage_async", - "title": "vision deleteReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.delete_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteReferenceImage", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteReferenceImage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "DeleteReferenceImage", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListReferenceImages_async", - "title": "vision listReferenceImages Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.list_reference_images.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListReferenceImages", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListReferenceImages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ListReferenceImagesResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "ListReferenceImages", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListReferenceImages", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetReferenceImage_async", - "title": "vision getReferenceImage Sample", - "origin": "API_DEFINITION", - "description": " Gets information associated with a ReferenceImage. Possible errors: * Returns NOT_FOUND if the specified image does not exist.", - "canonical": true, - "file": "product_search.get_reference_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetReferenceImage", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetReferenceImage", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ReferenceImage", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "GetReferenceImage", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetReferenceImage", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_AddProductToProductSet_async", - "title": "vision addProductToProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.add_product_to_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddProductToProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.AddProductToProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "AddProductToProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.AddProductToProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_RemoveProductFromProductSet_async", - "title": "vision removeProductFromProductSet Sample", - "origin": "API_DEFINITION", - "description": " Removes a Product from the specified ProductSet.", - "canonical": true, - "file": "product_search.remove_product_from_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveProductFromProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.RemoveProductFromProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "RemoveProductFromProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.RemoveProductFromProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProductsInProductSet_async", - "title": "vision listProductsInProductSet Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "product_search.list_products_in_product_set.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProductsInProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProductsInProductSet", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "ListProductsInProductSet", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProductsInProductSet", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_ImportProductSets_async", - "title": "vision importProductSets Sample", - "origin": "API_DEFINITION", - "description": " 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].", - "canonical": true, - "file": "product_search.import_product_sets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportProductSets", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ImportProductSets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "ImportProductSets", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ImportProductSets", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - }, - { - "regionTag": "vision_v1p4beta1_generated_ProductSearch_PurgeProducts_async", - "title": "vision purgeProducts Sample", - "origin": "API_DEFINITION", - "description": " 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)", - "canonical": true, - "file": "product_search.purge_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.PurgeProducts", - "async": true, - "parameters": [ - { - "name": "product_set_purge_config", - "type": ".google.cloud.vision.v1p4beta1.ProductSetPurgeConfig" - }, - { - "name": "delete_orphan_products", - "type": "TYPE_BOOL" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductSearchClient", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearchClient" - }, - "method": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.PurgeProducts", - "service": { - "shortName": "ProductSearch", - "fullName": "google.cloud.vision.v1p4beta1.ProductSearch" - } - } - } - } - ] -} \ No newline at end of file diff --git a/samples/package.json b/samples/package.json deleted file mode 100644 index a132ce6a..00000000 --- a/samples/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "nodejs-docs-samples-vision", - "private": true, - "license": "Apache-2.0", - "author": "Google LLC", - "engines": { - "node": ">=12.0.0" - }, - "files": [ - "*.js" - ], - "dependencies": { - "@google-cloud/vision": "^3.1.0", - "natural": "^6.0.0", - "pureimage": "^0.3.0", - "redis": "~4.5.0", - "yargs": "^16.0.0" - }, - "devDependencies": { - "@google-cloud/storage": "^6.0.0", - "chai": "^4.2.0", - "mocha": "^10.0.0", - "uuid": "^9.0.0" - } -} diff --git a/smoke-test/.eslintrc.yml b/smoke-test/.eslintrc.yml deleted file mode 100644 index 282535f5..00000000 --- a/smoke-test/.eslintrc.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -rules: - no-console: off diff --git a/smoke-test/image_annotator_smoke_test.js b/smoke-test/image_annotator_smoke_test.js deleted file mode 100644 index d7c97223..00000000 --- a/smoke-test/image_annotator_smoke_test.js +++ /dev/null @@ -1,55 +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 {describe, it} = require('mocha'); - -describe('ImageAnnotatorSmokeTest', () => { - it('successfully makes a call to the service', done => { - // eslint-disable-next-line node/no-missing-require - const vision = require('@google-cloud/vision'); - - const client = new vision.v1p3beta1.ImageAnnotatorClient({ - // optional auth parameters. - }); - - const gcsImageUri = - 'gs://cloud-samples-data/vision/face_detection/celebrity_recognition/sergey.jpg'; - const source = { - gcsImageUri: gcsImageUri, - }; - const image = { - source: source, - }; - const type = 'FACE_DETECTION'; - const featuresElement = { - type: type, - }; - const features = [featuresElement]; - const requestsElement = { - image: image, - features: features, - }; - const requests = [requestsElement]; - client - .batchAnnotateImages({requests: requests}) - .then(responses => { - const response = responses[0]; - console.log(response); - }) - .then(done) - .catch(done); - }); -}); diff --git a/src/helpers.ts b/src/helpers.ts deleted file mode 100644 index e363f3a0..00000000 --- a/src/helpers.ts +++ /dev/null @@ -1,1064 +0,0 @@ -// 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. ** - -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; - imageUri?: string; - }; - content?: Uint8Array | string | null; - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - features?: any; - imageContext?: any; -} - -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; -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-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}}, - } as unknown as ImprovedRequest; - } else { - 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} as unknown as ImprovedRequest; - } - return request as unknown as ImprovedRequest; -}; - -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)) { - request.image = {content: request.image.toString('base64')}; - } - - // 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 (err) { - callback(err); - return; - } - 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 as protoTypes.google.cloud.vision.v1.IAnnotateImageRequest - ); - } -}; - -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, - {}, - {} - > - ) { - // confidence 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. - const annotateImageRequest: ImprovedRequest = _requestToObject(request); - // If a callback was provided and options were skipped, normalize - // the argument names. - 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. - annotateImageRequest.features = annotateImageRequest.features || [ - { - type: featureValue, - }, - ]; - - // If the user submitted explicit features that do not line up with - // the precise method called, throw an exception. - for (const feature of annotateImageRequest.features) { - if (feature.type !== featureValue) { - throw new Error( - 'Setting explicit features is not supported on this method. ' + - 'Use the #annotateImage method instead.' - ); - } - } - // Call the underlying #annotateImage method. - return this.annotateImage(annotateImageRequest, callOptions, callback!); - }; -}; - -export function call(apiVersion: string) { - const methods: FeaturesMethod = {} as unknown as FeaturesMethod; - /** - * Annotate a single image with the requested features. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#annotateImage - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object[]} request.features An array of the specific annotation - * features being requested. This should take a form such as: - * - * [{type: vision.types.Feature.Type.FACE_DETECTION}, - * {type: vision.types.Feature.Type.WEB_DETECTION}] - * - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: {source: {imageUri: 'gs://path/to/image.jpg'}}, - * features: [], - * }; - * client - * .annotateImage(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - 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. - 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: Error | null, - req: protoTypes.google.cloud.vision.v1.IAnnotateImageRequest | undefined - ) => { - if (err) { - return ( - callback as unknown as gax.Callback< - protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, - {}, - {} - > - )(err); - } - - // 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); - } - - // 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( - // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../protos/protos.json') - ); - const features = ( - protoFilesRoot.lookup( - `google.cloud.vision.${apiVersion}.Feature.Type` - ) as gax.protobuf.Enum - ).values; - - /** - * Annotate a single image with face detection. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#faceDetection - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .faceDetection(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.faceDetection = promisify( - _createSingleFeatureMethod(features!.FACE_DETECTION) - ); - /** - * Annotate a single image with landmark detection. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#landmarkDetection - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .landmarkDetection(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.landmarkDetection = promisify( - _createSingleFeatureMethod(features!.LANDMARK_DETECTION) - ); - /** - * Annotate a single image with logo detection. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#logoDetection - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .logoDetection(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.logoDetection = promisify( - _createSingleFeatureMethod(features.LOGO_DETECTION) - ); - /** - * Annotate a single image with label detection. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#labelDetection - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .labelDetection(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.labelDetection = promisify( - _createSingleFeatureMethod(features!.LABEL_DETECTION) - ); - /** - * Annotate a single image with text detection. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#textDetection - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .textDetection(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.textDetection = promisify( - _createSingleFeatureMethod(features.TEXT_DETECTION) - ); - /** - * Annotate a single image with document text detection. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#documentTextDetection - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .documentTextDetection(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.documentTextDetection = promisify( - _createSingleFeatureMethod(features.DOCUMENT_TEXT_DETECTION) - ); - /** - * Annotate a single image with safe search detection. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#safeSearchDetection - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .safeSearchDetection(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.safeSearchDetection = promisify( - _createSingleFeatureMethod(features!.SAFE_SEARCH_DETECTION) - ); - /** - * Annotate a single image with image properties. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#imageProperties - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .imageProperties(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.imageProperties = promisify( - _createSingleFeatureMethod(features!.IMAGE_PROPERTIES) - ); - /** - * Annotate a single image with crop hints. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#cropHints - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .cropHints(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.cropHints = promisify( - _createSingleFeatureMethod(features!.CROP_HINTS) - ); - /** - * Annotate a single image with web detection. - * - * @see v1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1.AnnotateImageRequest - * - * @method v1.ImageAnnotatorClient#webDetection - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link 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.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .webDetection(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - - methods.webDetection = promisify( - _createSingleFeatureMethod(features!.WEB_DETECTION) - ); - /** - * Annotate a single image with the result from Product Search. - * - * @see v1p3beta1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1p3beta1.AnnotateImageRequest - * - * @method v1p3beta1.ImageAnnotatorClient#productSearch - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1p3beta1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * @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 BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * const vision = require('@google-cloud/vision').v1p3beta1; - * const client = new vision.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .productSearch(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - if (features!.PRODUCT_SEARCH !== undefined) { - methods.productSearch = promisify( - _createSingleFeatureMethod(features!.PRODUCT_SEARCH) - ); - } - /** - * Annotate a single image with localization vectors. - * - * @see v1p3beta1.ImageAnnotatorClient#batchAnnotateImages - * @see google.cloud.vision.v1p3beta1.AnnotateImageRequest - * - * @method v1p3beta1.ImageAnnotatorClient#objectLocalization - * @param {object|string|Buffer} request A representation of the request - * being sent to the Vision API. This is an - * {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}. - * For simple cases, you may also send a string (the URL or filename of - * the image) or a buffer (the image itself). - * @param {object} request.image A dictionary-like object representing the - * image. This should have a single key (`source`, `content`). - * - * If the key is `source`, the value should be another object containing - * `imageUri` or `filename` as a key and a string as a value. - * - * If the key is `content`, the value should be a Buffer. - * @param {object} [callOptions] Optional parameters. You can override the - * default settings for this call, e.g, timeout, retries, paginations, - * etc. See {@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions| gax.CallOptions} - * for the details. - * @param {function(?Error, ?object)} [callback] The function which will be - * called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * @returns {Promise} The promise which resolves to an array. The first - * element of the array is an object representing - * [BatchAnnotateImagesResponse]{@link BatchAnnotateImagesResponse}. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * // Object localization is only available in v1p3beta1. - * const vision = require('@google-cloud/vision').v1p3beta1; - * const client = new vision.ImageAnnotatorClient(); - * - * const request = { - * image: { - * source: {imageUri: 'gs://path/to/image.jpg'} - * } - * }; - * - * client - * .objectLocalization(request) - * .then(response => { - * // doThingsWith(response); - * }) - * .catch(err => { - * console.error(err); - * }); - */ - if (features!.OBJECT_LOCALIZATION !== undefined) { - methods.objectLocalization = promisify( - _createSingleFeatureMethod(features!.OBJECT_LOCALIZATION) - ); - } - return methods; -} diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index a1cdd8b3..00000000 --- a/src/index.ts +++ /dev/null @@ -1,49 +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. -// -// ** This file is automatically generated by synthtool. ** -// ** https://github.com/googleapis/synthtool ** -// ** 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'; - -const ImageAnnotatorClient = v1.ImageAnnotatorClient; -type ImageAnnotatorClient = v1.ImageAnnotatorClient; -const ProductSearchClient = v1.ProductSearchClient; -type ProductSearchClient = v1.ProductSearchClient; - -export { - v1, - v1p1beta1, - v1p2beta1, - v1p3beta1, - v1p4beta1, - ImageAnnotatorClient, - ProductSearchClient, -}; -export default { - v1, - v1p1beta1, - v1p2beta1, - v1p3beta1, - v1p4beta1, - ImageAnnotatorClient, - ProductSearchClient, -}; -import * as protos from '../protos/protos'; -export {protos}; diff --git a/src/v1/gapic_metadata.json b/src/v1/gapic_metadata.json deleted file mode 100644 index 13fb1dac..00000000 --- a/src/v1/gapic_metadata.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.vision.v1", - "libraryPackage": "@google-cloud/vision", - "services": { - "ImageAnnotator": { - "clients": { - "grpc": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - }, - "BatchAnnotateFiles": { - "methods": [ - "batchAnnotateFiles" - ] - }, - "AsyncBatchAnnotateImages": { - "methods": [ - "asyncBatchAnnotateImages" - ] - }, - "AsyncBatchAnnotateFiles": { - "methods": [ - "asyncBatchAnnotateFiles" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - }, - "BatchAnnotateFiles": { - "methods": [ - "batchAnnotateFiles" - ] - }, - "AsyncBatchAnnotateImages": { - "methods": [ - "asyncBatchAnnotateImages" - ] - }, - "AsyncBatchAnnotateFiles": { - "methods": [ - "asyncBatchAnnotateFiles" - ] - } - } - } - } - }, - "ProductSearch": { - "clients": { - "grpc": { - "libraryClient": "ProductSearchClient", - "rpcs": { - "CreateProductSet": { - "methods": [ - "createProductSet" - ] - }, - "GetProductSet": { - "methods": [ - "getProductSet" - ] - }, - "UpdateProductSet": { - "methods": [ - "updateProductSet" - ] - }, - "DeleteProductSet": { - "methods": [ - "deleteProductSet" - ] - }, - "CreateProduct": { - "methods": [ - "createProduct" - ] - }, - "GetProduct": { - "methods": [ - "getProduct" - ] - }, - "UpdateProduct": { - "methods": [ - "updateProduct" - ] - }, - "DeleteProduct": { - "methods": [ - "deleteProduct" - ] - }, - "CreateReferenceImage": { - "methods": [ - "createReferenceImage" - ] - }, - "DeleteReferenceImage": { - "methods": [ - "deleteReferenceImage" - ] - }, - "GetReferenceImage": { - "methods": [ - "getReferenceImage" - ] - }, - "AddProductToProductSet": { - "methods": [ - "addProductToProductSet" - ] - }, - "RemoveProductFromProductSet": { - "methods": [ - "removeProductFromProductSet" - ] - }, - "ImportProductSets": { - "methods": [ - "importProductSets" - ] - }, - "PurgeProducts": { - "methods": [ - "purgeProducts" - ] - }, - "ListProductSets": { - "methods": [ - "listProductSets", - "listProductSetsStream", - "listProductSetsAsync" - ] - }, - "ListProducts": { - "methods": [ - "listProducts", - "listProductsStream", - "listProductsAsync" - ] - }, - "ListReferenceImages": { - "methods": [ - "listReferenceImages", - "listReferenceImagesStream", - "listReferenceImagesAsync" - ] - }, - "ListProductsInProductSet": { - "methods": [ - "listProductsInProductSet", - "listProductsInProductSetStream", - "listProductsInProductSetAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ProductSearchClient", - "rpcs": { - "CreateProductSet": { - "methods": [ - "createProductSet" - ] - }, - "GetProductSet": { - "methods": [ - "getProductSet" - ] - }, - "UpdateProductSet": { - "methods": [ - "updateProductSet" - ] - }, - "DeleteProductSet": { - "methods": [ - "deleteProductSet" - ] - }, - "CreateProduct": { - "methods": [ - "createProduct" - ] - }, - "GetProduct": { - "methods": [ - "getProduct" - ] - }, - "UpdateProduct": { - "methods": [ - "updateProduct" - ] - }, - "DeleteProduct": { - "methods": [ - "deleteProduct" - ] - }, - "CreateReferenceImage": { - "methods": [ - "createReferenceImage" - ] - }, - "DeleteReferenceImage": { - "methods": [ - "deleteReferenceImage" - ] - }, - "GetReferenceImage": { - "methods": [ - "getReferenceImage" - ] - }, - "AddProductToProductSet": { - "methods": [ - "addProductToProductSet" - ] - }, - "RemoveProductFromProductSet": { - "methods": [ - "removeProductFromProductSet" - ] - }, - "ImportProductSets": { - "methods": [ - "importProductSets" - ] - }, - "PurgeProducts": { - "methods": [ - "purgeProducts" - ] - }, - "ListProductSets": { - "methods": [ - "listProductSets", - "listProductSetsStream", - "listProductSetsAsync" - ] - }, - "ListProducts": { - "methods": [ - "listProducts", - "listProductsStream", - "listProductsAsync" - ] - }, - "ListReferenceImages": { - "methods": [ - "listReferenceImages", - "listReferenceImagesStream", - "listReferenceImagesAsync" - ] - }, - "ListProductsInProductSet": { - "methods": [ - "listProductsInProductSet", - "listProductsInProductSetStream", - "listProductsInProductSetAsync" - ] - } - } - } - } - } - } -} diff --git a/src/v1/image_annotator_client.ts b/src/v1/image_annotator_client.ts deleted file mode 100644 index 26e2076f..00000000 --- a/src/v1/image_annotator_client.ts +++ /dev/null @@ -1,1134 +0,0 @@ -// Copyright 2023 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/image_annotator_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -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 _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - imageAnnotatorStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ImageAnnotatorClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ImageAnnotatorClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // 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 this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // 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 lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [ - { - selector: 'google.longrunning.Operations.GetOperation', - get: '/v1/{name=projects/*/operations/*}', - additional_bindings: [ - {get: '/v1/{name=projects/*/locations/*/operations/*}'}, - {get: '/v1/{name=operations/*}'}, - {get: '/v1/{name=locations/*/operations/*}'}, - ], - }, - ]; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .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 this._gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateImagesResponse.decode.bind( - asyncBatchAnnotateImagesResponse - ), - asyncBatchAnnotateImagesMetadata.decode.bind( - asyncBatchAnnotateImagesMetadata - ) - ), - asyncBatchAnnotateFiles: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateFilesResponse.decode.bind( - asyncBatchAnnotateFilesResponse - ), - asyncBatchAnnotateFilesMetadata.decode.bind( - asyncBatchAnnotateFilesMetadata - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.imageAnnotatorStub) { - return this.imageAnnotatorStub; - } - - // Put together the "service stub" for - // google.cloud.vision.v1.ImageAnnotator. - this.imageAnnotatorStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.vision.v1.ImageAnnotator' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vision.v1.ImageAnnotator, - this._opts, - this._providedCustomServicePath - ) 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 callPromise = this.imageAnnotatorStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = this.descriptors.longrunning[methodName] || undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.imageAnnotatorStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - 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. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/image_annotator.batch_annotate_images.js - * region_tag:vision_v1_generated_ImageAnnotator_BatchAnnotateImages_async - */ - batchAnnotateImages( - request?: protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest | undefined, - {} | undefined - ] - >; - batchAnnotateImages( - request: protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request: protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest, - callback: Callback< - protos.google.cloud.vision.v1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request?: protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IBatchAnnotateImagesRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/image_annotator.batch_annotate_files.js - * region_tag:vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_async - */ - batchAnnotateFiles( - request?: protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest | undefined, - {} | undefined - ] - >; - batchAnnotateFiles( - request: protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IBatchAnnotateFilesResponse, - | protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateFiles( - request: protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest, - callback: Callback< - protos.google.cloud.vision.v1.IBatchAnnotateFilesResponse, - | protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateFiles( - request?: protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IBatchAnnotateFilesResponse, - | protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IBatchAnnotateFilesResponse, - | protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IBatchAnnotateFilesRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - 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 {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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/image_annotator.async_batch_annotate_images.js - * region_tag:vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async - */ - asyncBatchAnnotateImages( - request?: protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - asyncBatchAnnotateImages( - request: protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateImages( - request: protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateImages( - request?: protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.asyncBatchAnnotateImages( - request, - options, - callback - ); - } - /** - * Check the status of the long running operation returned by `asyncBatchAnnotateImages()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/image_annotator.async_batch_annotate_images.js - * region_tag:vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async - */ - async checkAsyncBatchAnnotateImagesProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.asyncBatchAnnotateImages, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.OperationMetadata - >; - } - /** - * 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/image_annotator.async_batch_annotate_files.js - * region_tag:vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async - */ - asyncBatchAnnotateFiles( - request?: protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - asyncBatchAnnotateFiles( - request: protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateFiles( - request: protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateFiles( - request?: protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.asyncBatchAnnotateFiles( - request, - options, - callback - ); - } - /** - * Check the status of the long running operation returned by `asyncBatchAnnotateFiles()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/image_annotator.async_batch_annotate_files.js - * region_tag:vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async - */ - async checkAsyncBatchAnnotateFilesProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.asyncBatchAnnotateFiles, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.OperationMetadata - >; - } - // -------------------- - // -- 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: project, - location: location, - product: 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: project, - location: 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: project, - location: location, - product: 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. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.imageAnnotatorStub && !this._terminated) { - return this.imageAnnotatorStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} -import {FeaturesMethod} from '../helpers'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/src/v1/image_annotator_client_config.json b/src/v1/image_annotator_client_config.json deleted file mode 100644 index 08f87df9..00000000 --- a/src/v1/image_annotator_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.vision.v1.ImageAnnotator": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "BatchAnnotateImages": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "BatchAnnotateFiles": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AsyncBatchAnnotateImages": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AsyncBatchAnnotateFiles": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/src/v1/image_annotator_proto_list.json b/src/v1/image_annotator_proto_list.json deleted file mode 100644 index 0d468bf9..00000000 --- a/src/v1/image_annotator_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../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/src/v1/index.ts b/src/v1/index.ts deleted file mode 100644 index 4cbdef94..00000000 --- a/src/v1/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2023 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/src/v1/product_search_client.ts b/src/v1/product_search_client.ts deleted file mode 100644 index 53b85968..00000000 --- a/src/v1/product_search_client.ts +++ /dev/null @@ -1,3119 +0,0 @@ -// Copyright 2023 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, - PaginationCallback, - GaxCall, -} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/product_search_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -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 {@link google.cloud.vision.v1.ProductSet|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 {@link google.cloud.vision.v1.Product|Product} resources, named - * `projects/* /locations/* /products/*` - * - * - Each {@link google.cloud.vision.v1.Product|Product} has a collection of {@link google.cloud.vision.v1.ReferenceImage|ReferenceImage} resources, named - * `projects/* /locations/* /products/* /referenceImages/*` - * @class - * @memberof v1 - */ -export class ProductSearchClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - productSearchStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProductSearchClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ProductSearchClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProductSearchClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // 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 this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new this._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 this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'productSets' - ), - listProducts: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - listReferenceImages: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'referenceImages' - ), - listProductsInProductSet: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // 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 lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [ - { - selector: 'google.longrunning.Operations.GetOperation', - get: '/v1/{name=projects/*/operations/*}', - additional_bindings: [ - {get: '/v1/{name=projects/*/locations/*/operations/*}'}, - {get: '/v1/{name=operations/*}'}, - {get: '/v1/{name=locations/*/operations/*}'}, - ], - }, - ]; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .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 this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importProductSetsResponse.decode.bind(importProductSetsResponse), - importProductSetsMetadata.decode.bind(importProductSetsMetadata) - ), - purgeProducts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - purgeProductsResponse.decode.bind(purgeProductsResponse), - purgeProductsMetadata.decode.bind(purgeProductsMetadata) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.productSearchStub) { - return this.productSearchStub; - } - - // Put together the "service stub" for - // google.cloud.vision.v1.ProductSearch. - this.productSearchStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.vision.v1.ProductSearch' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vision.v1.ProductSearch, - this._opts, - this._providedCustomServicePath - ) 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 callPromise = this.productSearchStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.productSearchStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - 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. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.create_product_set.js - * region_tag:vision_v1_generated_ProductSearch_CreateProductSet_async - */ - createProductSet( - request?: protos.google.cloud.vision.v1.ICreateProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.ICreateProductSetRequest | undefined, - {} | undefined - ] - >; - createProductSet( - request: protos.google.cloud.vision.v1.ICreateProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.ICreateProductSetRequest | null | undefined, - {} | null | undefined - > - ): void; - createProductSet( - request: protos.google.cloud.vision.v1.ICreateProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.ICreateProductSetRequest | null | undefined, - {} | null | undefined - > - ): void; - createProductSet( - request?: protos.google.cloud.vision.v1.ICreateProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IProductSet, - | protos.google.cloud.vision.v1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.ICreateProductSetRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.ICreateProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createProductSet(request, options, callback); - } - /** - * 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.v1.ProductSet}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.get_product_set.js - * region_tag:vision_v1_generated_ProductSearch_GetProductSet_async - */ - getProductSet( - request?: protos.google.cloud.vision.v1.IGetProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IGetProductSetRequest | undefined, - {} | undefined - ] - >; - getProductSet( - request: protos.google.cloud.vision.v1.IGetProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IGetProductSetRequest | null | undefined, - {} | null | undefined - > - ): void; - getProductSet( - request: protos.google.cloud.vision.v1.IGetProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IGetProductSetRequest | null | undefined, - {} | null | undefined - > - ): void; - getProductSet( - request?: protos.google.cloud.vision.v1.IGetProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IProductSet, - | protos.google.cloud.vision.v1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IGetProductSetRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IGetProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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 {@link google.protobuf.FieldMask|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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.update_product_set.js - * region_tag:vision_v1_generated_ProductSearch_UpdateProductSet_async - */ - updateProductSet( - request?: protos.google.cloud.vision.v1.IUpdateProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IUpdateProductSetRequest | undefined, - {} | undefined - ] - >; - updateProductSet( - request: protos.google.cloud.vision.v1.IUpdateProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IUpdateProductSetRequest | null | undefined, - {} | null | undefined - > - ): void; - updateProductSet( - request: protos.google.cloud.vision.v1.IUpdateProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IUpdateProductSetRequest | null | undefined, - {} | null | undefined - > - ): void; - updateProductSet( - request?: protos.google.cloud.vision.v1.IUpdateProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IProductSet, - | protos.google.cloud.vision.v1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IUpdateProductSetRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProductSet, - protos.google.cloud.vision.v1.IUpdateProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'product_set.name': request.productSet!.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.delete_product_set.js - * region_tag:vision_v1_generated_ProductSearch_DeleteProductSet_async - */ - deleteProductSet( - request?: protos.google.cloud.vision.v1.IDeleteProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductSetRequest | undefined, - {} | undefined - ] - >; - deleteProductSet( - request: protos.google.cloud.vision.v1.IDeleteProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductSetRequest | null | undefined, - {} | null | undefined - > - ): void; - deleteProductSet( - request: protos.google.cloud.vision.v1.IDeleteProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductSetRequest | null | undefined, - {} | null | undefined - > - ): void; - deleteProductSet( - request?: protos.google.cloud.vision.v1.IDeleteProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductSetRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.create_product.js - * region_tag:vision_v1_generated_ProductSearch_CreateProduct_async - */ - createProduct( - request?: protos.google.cloud.vision.v1.ICreateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.ICreateProductRequest | undefined, - {} | undefined - ] - >; - createProduct( - request: protos.google.cloud.vision.v1.ICreateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.ICreateProductRequest | null | undefined, - {} | null | undefined - > - ): void; - createProduct( - request: protos.google.cloud.vision.v1.ICreateProductRequest, - callback: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.ICreateProductRequest | null | undefined, - {} | null | undefined - > - ): void; - createProduct( - request?: protos.google.cloud.vision.v1.ICreateProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IProduct, - | protos.google.cloud.vision.v1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.ICreateProductRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.ICreateProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createProduct(request, options, callback); - } - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.get_product.js - * region_tag:vision_v1_generated_ProductSearch_GetProduct_async - */ - getProduct( - request?: protos.google.cloud.vision.v1.IGetProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IGetProductRequest | undefined, - {} | undefined - ] - >; - getProduct( - request: protos.google.cloud.vision.v1.IGetProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IGetProductRequest | null | undefined, - {} | null | undefined - > - ): void; - getProduct( - request: protos.google.cloud.vision.v1.IGetProductRequest, - callback: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IGetProductRequest | null | undefined, - {} | null | undefined - > - ): void; - getProduct( - request?: protos.google.cloud.vision.v1.IGetProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IGetProductRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IGetProductRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IGetProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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 {@link google.protobuf.FieldMask|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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.update_product.js - * region_tag:vision_v1_generated_ProductSearch_UpdateProduct_async - */ - updateProduct( - request?: protos.google.cloud.vision.v1.IUpdateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IUpdateProductRequest | undefined, - {} | undefined - ] - >; - updateProduct( - request: protos.google.cloud.vision.v1.IUpdateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IUpdateProductRequest | null | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request: protos.google.cloud.vision.v1.IUpdateProductRequest, - callback: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IUpdateProductRequest | null | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request?: protos.google.cloud.vision.v1.IUpdateProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IProduct, - | protos.google.cloud.vision.v1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IUpdateProductRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct, - protos.google.cloud.vision.v1.IUpdateProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'product.name': request.product!.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.delete_product.js - * region_tag:vision_v1_generated_ProductSearch_DeleteProduct_async - */ - deleteProduct( - request?: protos.google.cloud.vision.v1.IDeleteProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductRequest | undefined, - {} | undefined - ] - >; - deleteProduct( - request: protos.google.cloud.vision.v1.IDeleteProductRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductRequest | null | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request: protos.google.cloud.vision.v1.IDeleteProductRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductRequest | null | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request?: protos.google.cloud.vision.v1.IDeleteProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.create_reference_image.js - * region_tag:vision_v1_generated_ProductSearch_CreateReferenceImage_async - */ - createReferenceImage( - request?: protos.google.cloud.vision.v1.ICreateReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IReferenceImage, - protos.google.cloud.vision.v1.ICreateReferenceImageRequest | undefined, - {} | undefined - ] - >; - createReferenceImage( - request: protos.google.cloud.vision.v1.ICreateReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IReferenceImage, - | protos.google.cloud.vision.v1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createReferenceImage( - request: protos.google.cloud.vision.v1.ICreateReferenceImageRequest, - callback: Callback< - protos.google.cloud.vision.v1.IReferenceImage, - | protos.google.cloud.vision.v1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createReferenceImage( - request?: protos.google.cloud.vision.v1.ICreateReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IReferenceImage, - | protos.google.cloud.vision.v1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IReferenceImage, - | protos.google.cloud.vision.v1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IReferenceImage, - protos.google.cloud.vision.v1.ICreateReferenceImageRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.delete_reference_image.js - * region_tag:vision_v1_generated_ProductSearch_DeleteReferenceImage_async - */ - deleteReferenceImage( - request?: protos.google.cloud.vision.v1.IDeleteReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteReferenceImageRequest | undefined, - {} | undefined - ] - >; - deleteReferenceImage( - request: protos.google.cloud.vision.v1.IDeleteReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteReferenceImage( - request: protos.google.cloud.vision.v1.IDeleteReferenceImageRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteReferenceImage( - request?: protos.google.cloud.vision.v1.IDeleteReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IDeleteReferenceImageRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteReferenceImage(request, options, callback); - } - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.get_reference_image.js - * region_tag:vision_v1_generated_ProductSearch_GetReferenceImage_async - */ - getReferenceImage( - request?: protos.google.cloud.vision.v1.IGetReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IReferenceImage, - protos.google.cloud.vision.v1.IGetReferenceImageRequest | undefined, - {} | undefined - ] - >; - getReferenceImage( - request: protos.google.cloud.vision.v1.IGetReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1.IReferenceImage, - | protos.google.cloud.vision.v1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getReferenceImage( - request: protos.google.cloud.vision.v1.IGetReferenceImageRequest, - callback: Callback< - protos.google.cloud.vision.v1.IReferenceImage, - | protos.google.cloud.vision.v1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getReferenceImage( - request?: protos.google.cloud.vision.v1.IGetReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1.IReferenceImage, - | protos.google.cloud.vision.v1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1.IReferenceImage, - | protos.google.cloud.vision.v1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1.IReferenceImage, - protos.google.cloud.vision.v1.IGetReferenceImageRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.add_product_to_product_set.js - * region_tag:vision_v1_generated_ProductSearch_AddProductToProductSet_async - */ - addProductToProductSet( - request?: protos.google.cloud.vision.v1.IAddProductToProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IAddProductToProductSetRequest | undefined, - {} | undefined - ] - >; - addProductToProductSet( - request: protos.google.cloud.vision.v1.IAddProductToProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - addProductToProductSet( - request: protos.google.cloud.vision.v1.IAddProductToProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - addProductToProductSet( - request?: protos.google.cloud.vision.v1.IAddProductToProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IAddProductToProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/product_search.remove_product_from_product_set.js - * region_tag:vision_v1_generated_ProductSearch_RemoveProductFromProductSet_async - */ - removeProductFromProductSet( - request?: protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest - | undefined - ), - {} | undefined - ] - >; - removeProductFromProductSet( - request: protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - removeProductFromProductSet( - request: protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - removeProductFromProductSet( - request?: protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1.IRemoveProductFromProductSetRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.removeProductFromProductSet( - request, - options, - callback - ); - } - - /** - * Asynchronous API that imports a list of reference images to specified - * product sets based on a list of image information. - * - * The {@link 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 - * {@link google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri|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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/product_search.import_product_sets.js - * region_tag:vision_v1_generated_ProductSearch_ImportProductSets_async - */ - importProductSets( - request?: protos.google.cloud.vision.v1.IImportProductSetsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1.IImportProductSetsResponse, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - importProductSets( - request: protos.google.cloud.vision.v1.IImportProductSetsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1.IImportProductSetsResponse, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProductSets( - request: protos.google.cloud.vision.v1.IImportProductSetsRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1.IImportProductSetsResponse, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProductSets( - request?: protos.google.cloud.vision.v1.IImportProductSetsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1.IImportProductSetsResponse, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1.IImportProductSetsResponse, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1.IImportProductSetsResponse, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importProductSets(request, options, callback); - } - /** - * Check the status of the long running operation returned by `importProductSets()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/product_search.import_product_sets.js - * region_tag:vision_v1_generated_ProductSearch_ImportProductSets_async - */ - async checkImportProductSetsProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1.ImportProductSetsResponse, - protos.google.cloud.vision.v1.BatchOperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.importProductSets, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1.ImportProductSetsResponse, - protos.google.cloud.vision.v1.BatchOperationMetadata - >; - } - /** - * 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 {@link 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/product_search.purge_products.js - * region_tag:vision_v1_generated_ProductSearch_PurgeProducts_async - */ - purgeProducts( - request?: protos.google.cloud.vision.v1.IPurgeProductsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - purgeProducts( - request: protos.google.cloud.vision.v1.IPurgeProductsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - purgeProducts( - request: protos.google.cloud.vision.v1.IPurgeProductsRequest, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - purgeProducts( - request?: protos.google.cloud.vision.v1.IPurgeProductsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.purgeProducts(request, options, callback); - } - /** - * Check the status of the long running operation returned by `purgeProducts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/product_search.purge_products.js - * region_tag:vision_v1_generated_ProductSearch_PurgeProducts_async - */ - async checkPurgeProductsProgress( - name: string - ): Promise< - LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.vision.v1.BatchOperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.purgeProducts, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.vision.v1.BatchOperationMetadata - >; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductSetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductSets( - request?: protos.google.cloud.vision.v1.IListProductSetsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProductSet[], - protos.google.cloud.vision.v1.IListProductSetsRequest | null, - protos.google.cloud.vision.v1.IListProductSetsResponse - ] - >; - listProductSets( - request: protos.google.cloud.vision.v1.IListProductSetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1.IListProductSetsRequest, - protos.google.cloud.vision.v1.IListProductSetsResponse | null | undefined, - protos.google.cloud.vision.v1.IProductSet - > - ): void; - listProductSets( - request: protos.google.cloud.vision.v1.IListProductSetsRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1.IListProductSetsRequest, - protos.google.cloud.vision.v1.IListProductSetsResponse | null | undefined, - protos.google.cloud.vision.v1.IProductSet - > - ): void; - listProductSets( - request?: protos.google.cloud.vision.v1.IListProductSetsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1.IListProductSetsRequest, - | protos.google.cloud.vision.v1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1.IProductSet - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1.IListProductSetsRequest, - protos.google.cloud.vision.v1.IListProductSetsResponse | null | undefined, - protos.google.cloud.vision.v1.IProductSet - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProductSet[], - protos.google.cloud.vision.v1.IListProductSetsRequest | null, - protos.google.cloud.vision.v1.IListProductSetsResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProductSets(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductSetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductSetsStream( - request?: protos.google.cloud.vision.v1.IListProductSetsRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProductSets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductSets.createStream( - this.innerApiCalls.listProductSets as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProductSets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ProductSet]{@link google.cloud.vision.v1.ProductSet}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/product_search.list_product_sets.js - * region_tag:vision_v1_generated_ProductSearch_ListProductSets_async - */ - listProductSetsAsync( - request?: protos.google.cloud.vision.v1.IListProductSetsRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProductSets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductSets.asyncIterate( - this.innerApiCalls['listProductSets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProducts( - request?: protos.google.cloud.vision.v1.IListProductsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct[], - protos.google.cloud.vision.v1.IListProductsRequest | null, - protos.google.cloud.vision.v1.IListProductsResponse - ] - >; - listProducts( - request: protos.google.cloud.vision.v1.IListProductsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1.IListProductsRequest, - protos.google.cloud.vision.v1.IListProductsResponse | null | undefined, - protos.google.cloud.vision.v1.IProduct - > - ): void; - listProducts( - request: protos.google.cloud.vision.v1.IListProductsRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1.IListProductsRequest, - protos.google.cloud.vision.v1.IListProductsResponse | null | undefined, - protos.google.cloud.vision.v1.IProduct - > - ): void; - listProducts( - request?: protos.google.cloud.vision.v1.IListProductsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1.IListProductsRequest, - | protos.google.cloud.vision.v1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1.IProduct - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1.IListProductsRequest, - protos.google.cloud.vision.v1.IListProductsResponse | null | undefined, - protos.google.cloud.vision.v1.IProduct - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct[], - protos.google.cloud.vision.v1.IListProductsRequest | null, - protos.google.cloud.vision.v1.IListProductsResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProducts(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsStream( - request?: protos.google.cloud.vision.v1.IListProductsRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProducts.createStream( - this.innerApiCalls.listProducts as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProducts`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Product]{@link google.cloud.vision.v1.Product}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/product_search.list_products.js - * region_tag:vision_v1_generated_ProductSearch_ListProducts_async - */ - listProductsAsync( - request?: protos.google.cloud.vision.v1.IListProductsRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProducts.asyncIterate( - this.innerApiCalls['listProducts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listReferenceImagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listReferenceImages( - request?: protos.google.cloud.vision.v1.IListReferenceImagesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IReferenceImage[], - protos.google.cloud.vision.v1.IListReferenceImagesRequest | null, - protos.google.cloud.vision.v1.IListReferenceImagesResponse - ] - >; - listReferenceImages( - request: protos.google.cloud.vision.v1.IListReferenceImagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1.IReferenceImage - > - ): void; - listReferenceImages( - request: protos.google.cloud.vision.v1.IListReferenceImagesRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1.IReferenceImage - > - ): void; - listReferenceImages( - request?: protos.google.cloud.vision.v1.IListReferenceImagesRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1.IReferenceImage - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1.IReferenceImage - > - ): Promise< - [ - protos.google.cloud.vision.v1.IReferenceImage[], - protos.google.cloud.vision.v1.IListReferenceImagesRequest | null, - protos.google.cloud.vision.v1.IListReferenceImagesResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listReferenceImages(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listReferenceImagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listReferenceImagesStream( - request?: protos.google.cloud.vision.v1.IListReferenceImagesRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listReferenceImages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReferenceImages.createStream( - this.innerApiCalls.listReferenceImages as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listReferenceImages`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/product_search.list_reference_images.js - * region_tag:vision_v1_generated_ProductSearch_ListReferenceImages_async - */ - listReferenceImagesAsync( - request?: protos.google.cloud.vision.v1.IListReferenceImagesRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listReferenceImages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReferenceImages.asyncIterate( - this.innerApiCalls['listReferenceImages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductsInProductSetAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsInProductSet( - request?: protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct[], - protos.google.cloud.vision.v1.IListProductsInProductSetRequest | null, - protos.google.cloud.vision.v1.IListProductsInProductSetResponse - ] - >; - listProductsInProductSet( - request: protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1.IProduct - > - ): void; - listProductsInProductSet( - request: protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1.IProduct - > - ): void; - listProductsInProductSet( - request?: protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1.IProduct - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1.IProduct - > - ): Promise< - [ - protos.google.cloud.vision.v1.IProduct[], - protos.google.cloud.vision.v1.IListProductsInProductSetRequest | null, - protos.google.cloud.vision.v1.IListProductsInProductSetResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProductsInProductSet( - request, - options, - callback - ); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductsInProductSetAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsInProductSetStream( - request?: protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - const defaultCallSettings = this._defaults['listProductsInProductSet']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductsInProductSet.createStream( - this.innerApiCalls.listProductsInProductSet as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProductsInProductSet`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Product]{@link google.cloud.vision.v1.Product}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/product_search.list_products_in_product_set.js - * region_tag:vision_v1_generated_ProductSearch_ListProductsInProductSet_async - */ - listProductsInProductSetAsync( - request?: protos.google.cloud.vision.v1.IListProductsInProductSetRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - const defaultCallSettings = this._defaults['listProductsInProductSet']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductsInProductSet.asyncIterate( - this.innerApiCalls['listProductsInProductSet'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- 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: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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: project, - location: location, - product: 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: project, - location: 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: project, - location: location, - product: 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. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.productSearchStub && !this._terminated) { - return this.productSearchStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/src/v1/product_search_client_config.json b/src/v1/product_search_client_config.json deleted file mode 100644 index b7db1b90..00000000 --- a/src/v1/product_search_client_config.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "interfaces": { - "google.cloud.vision.v1.ProductSearch": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListProductSets": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateProduct": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListProducts": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetProduct": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateProduct": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteProduct": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListReferenceImages": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AddProductToProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RemoveProductFromProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListProductsInProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ImportProductSets": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PurgeProducts": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/src/v1/product_search_proto_list.json b/src/v1/product_search_proto_list.json deleted file mode 100644 index 0d468bf9..00000000 --- a/src/v1/product_search_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../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/src/v1p1beta1/gapic_metadata.json b/src/v1p1beta1/gapic_metadata.json deleted file mode 100644 index 2dc79630..00000000 --- a/src/v1p1beta1/gapic_metadata.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.vision.v1p1beta1", - "libraryPackage": "@google-cloud/vision", - "services": { - "ImageAnnotator": { - "clients": { - "grpc": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - } - } - } - } - } - } -} diff --git a/src/v1p1beta1/image_annotator_client.ts b/src/v1p1beta1/image_annotator_client.ts deleted file mode 100644 index 986e6d38..00000000 --- a/src/v1p1beta1/image_annotator_client.ts +++ /dev/null @@ -1,423 +0,0 @@ -// Copyright 2023 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p1beta1/image_annotator_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -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 v1p1beta1 - */ -export class ImageAnnotatorClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - imageAnnotatorStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ImageAnnotatorClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ImageAnnotatorClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.vision.v1p1beta1.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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.imageAnnotatorStub) { - return this.imageAnnotatorStub; - } - - // Put together the "service stub" for - // google.cloud.vision.v1p1beta1.ImageAnnotator. - this.imageAnnotatorStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.vision.v1p1beta1.ImageAnnotator' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vision.v1p1beta1.ImageAnnotator, - this._opts, - this._providedCustomServicePath - ) 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 callPromise = this.imageAnnotatorStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.imageAnnotatorStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - 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. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * 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.v1p1beta1.BatchAnnotateImagesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/image_annotator.batch_annotate_images.js - * region_tag:vision_v1p1beta1_generated_ImageAnnotator_BatchAnnotateImages_async - */ - batchAnnotateImages( - request?: protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, - ( - | protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest - | undefined - ), - {} | undefined - ] - >; - batchAnnotateImages( - request: protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request: protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest, - callback: Callback< - protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request?: protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, - ( - | protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.batchAnnotateImages(request, options, callback); - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.imageAnnotatorStub && !this._terminated) { - return this.imageAnnotatorStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} -import {FeaturesMethod} from '../helpers'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/src/v1p1beta1/image_annotator_client_config.json b/src/v1p1beta1/image_annotator_client_config.json deleted file mode 100644 index 469fb95c..00000000 --- a/src/v1p1beta1/image_annotator_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.vision.v1p1beta1.ImageAnnotator": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "BatchAnnotateImages": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/src/v1p1beta1/image_annotator_proto_list.json b/src/v1p1beta1/image_annotator_proto_list.json deleted file mode 100644 index 35609fc8..00000000 --- a/src/v1p1beta1/image_annotator_proto_list.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "../../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/src/v1p1beta1/index.ts b/src/v1p1beta1/index.ts deleted file mode 100644 index 19b34c96..00000000 --- a/src/v1p1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 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'; diff --git a/src/v1p2beta1/gapic_metadata.json b/src/v1p2beta1/gapic_metadata.json deleted file mode 100644 index 116ff853..00000000 --- a/src/v1p2beta1/gapic_metadata.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.vision.v1p2beta1", - "libraryPackage": "@google-cloud/vision", - "services": { - "ImageAnnotator": { - "clients": { - "grpc": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - }, - "AsyncBatchAnnotateFiles": { - "methods": [ - "asyncBatchAnnotateFiles" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - }, - "AsyncBatchAnnotateFiles": { - "methods": [ - "asyncBatchAnnotateFiles" - ] - } - } - } - } - } - } -} diff --git a/src/v1p2beta1/image_annotator_client.ts b/src/v1p2beta1/image_annotator_client.ts deleted file mode 100644 index a79354c4..00000000 --- a/src/v1p2beta1/image_annotator_client.ts +++ /dev/null @@ -1,608 +0,0 @@ -// Copyright 2023 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p2beta1/image_annotator_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -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 _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - operationsClient: gax.OperationsClient; - imageAnnotatorStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ImageAnnotatorClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ImageAnnotatorClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // 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 lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .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 this._gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateFilesResponse.decode.bind( - asyncBatchAnnotateFilesResponse - ), - asyncBatchAnnotateFilesMetadata.decode.bind( - asyncBatchAnnotateFilesMetadata - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.imageAnnotatorStub) { - return this.imageAnnotatorStub; - } - - // Put together the "service stub" for - // google.cloud.vision.v1p2beta1.ImageAnnotator. - this.imageAnnotatorStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.vision.v1p2beta1.ImageAnnotator' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vision.v1p2beta1.ImageAnnotator, - this._opts, - this._providedCustomServicePath - ) 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 callPromise = this.imageAnnotatorStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = this.descriptors.longrunning[methodName] || undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.imageAnnotatorStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - 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. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p2beta1/image_annotator.batch_annotate_images.js - * region_tag:vision_v1p2beta1_generated_ImageAnnotator_BatchAnnotateImages_async - */ - batchAnnotateImages( - request?: protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, - ( - | protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest - | undefined - ), - {} | undefined - ] - >; - batchAnnotateImages( - request: protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request: protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest, - callback: Callback< - protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request?: protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, - ( - | protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - 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 {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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p2beta1/image_annotator.async_batch_annotate_files.js - * region_tag:vision_v1p2beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async - */ - asyncBatchAnnotateFiles( - request?: protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - asyncBatchAnnotateFiles( - request: protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateFiles( - request: protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateFiles( - request?: protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.asyncBatchAnnotateFiles( - request, - options, - callback - ); - } - /** - * Check the status of the long running operation returned by `asyncBatchAnnotateFiles()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p2beta1/image_annotator.async_batch_annotate_files.js - * region_tag:vision_v1p2beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async - */ - async checkAsyncBatchAnnotateFilesProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.asyncBatchAnnotateFiles, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.OperationMetadata - >; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.imageAnnotatorStub && !this._terminated) { - return this.imageAnnotatorStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} -import {FeaturesMethod} from '../helpers'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/src/v1p2beta1/image_annotator_client_config.json b/src/v1p2beta1/image_annotator_client_config.json deleted file mode 100644 index 367627eb..00000000 --- a/src/v1p2beta1/image_annotator_client_config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "interfaces": { - "google.cloud.vision.v1p2beta1.ImageAnnotator": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "BatchAnnotateImages": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AsyncBatchAnnotateFiles": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/src/v1p2beta1/image_annotator_proto_list.json b/src/v1p2beta1/image_annotator_proto_list.json deleted file mode 100644 index 2b5904f9..00000000 --- a/src/v1p2beta1/image_annotator_proto_list.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "../../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/src/v1p2beta1/index.ts b/src/v1p2beta1/index.ts deleted file mode 100644 index 19b34c96..00000000 --- a/src/v1p2beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 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'; diff --git a/src/v1p3beta1/gapic_metadata.json b/src/v1p3beta1/gapic_metadata.json deleted file mode 100644 index 52ae14a4..00000000 --- a/src/v1p3beta1/gapic_metadata.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.vision.v1p3beta1", - "libraryPackage": "@google-cloud/vision", - "services": { - "ImageAnnotator": { - "clients": { - "grpc": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - }, - "AsyncBatchAnnotateFiles": { - "methods": [ - "asyncBatchAnnotateFiles" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - }, - "AsyncBatchAnnotateFiles": { - "methods": [ - "asyncBatchAnnotateFiles" - ] - } - } - } - } - }, - "ProductSearch": { - "clients": { - "grpc": { - "libraryClient": "ProductSearchClient", - "rpcs": { - "CreateProductSet": { - "methods": [ - "createProductSet" - ] - }, - "GetProductSet": { - "methods": [ - "getProductSet" - ] - }, - "UpdateProductSet": { - "methods": [ - "updateProductSet" - ] - }, - "DeleteProductSet": { - "methods": [ - "deleteProductSet" - ] - }, - "CreateProduct": { - "methods": [ - "createProduct" - ] - }, - "GetProduct": { - "methods": [ - "getProduct" - ] - }, - "UpdateProduct": { - "methods": [ - "updateProduct" - ] - }, - "DeleteProduct": { - "methods": [ - "deleteProduct" - ] - }, - "CreateReferenceImage": { - "methods": [ - "createReferenceImage" - ] - }, - "DeleteReferenceImage": { - "methods": [ - "deleteReferenceImage" - ] - }, - "GetReferenceImage": { - "methods": [ - "getReferenceImage" - ] - }, - "AddProductToProductSet": { - "methods": [ - "addProductToProductSet" - ] - }, - "RemoveProductFromProductSet": { - "methods": [ - "removeProductFromProductSet" - ] - }, - "ImportProductSets": { - "methods": [ - "importProductSets" - ] - }, - "ListProductSets": { - "methods": [ - "listProductSets", - "listProductSetsStream", - "listProductSetsAsync" - ] - }, - "ListProducts": { - "methods": [ - "listProducts", - "listProductsStream", - "listProductsAsync" - ] - }, - "ListReferenceImages": { - "methods": [ - "listReferenceImages", - "listReferenceImagesStream", - "listReferenceImagesAsync" - ] - }, - "ListProductsInProductSet": { - "methods": [ - "listProductsInProductSet", - "listProductsInProductSetStream", - "listProductsInProductSetAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ProductSearchClient", - "rpcs": { - "CreateProductSet": { - "methods": [ - "createProductSet" - ] - }, - "GetProductSet": { - "methods": [ - "getProductSet" - ] - }, - "UpdateProductSet": { - "methods": [ - "updateProductSet" - ] - }, - "DeleteProductSet": { - "methods": [ - "deleteProductSet" - ] - }, - "CreateProduct": { - "methods": [ - "createProduct" - ] - }, - "GetProduct": { - "methods": [ - "getProduct" - ] - }, - "UpdateProduct": { - "methods": [ - "updateProduct" - ] - }, - "DeleteProduct": { - "methods": [ - "deleteProduct" - ] - }, - "CreateReferenceImage": { - "methods": [ - "createReferenceImage" - ] - }, - "DeleteReferenceImage": { - "methods": [ - "deleteReferenceImage" - ] - }, - "GetReferenceImage": { - "methods": [ - "getReferenceImage" - ] - }, - "AddProductToProductSet": { - "methods": [ - "addProductToProductSet" - ] - }, - "RemoveProductFromProductSet": { - "methods": [ - "removeProductFromProductSet" - ] - }, - "ImportProductSets": { - "methods": [ - "importProductSets" - ] - }, - "ListProductSets": { - "methods": [ - "listProductSets", - "listProductSetsStream", - "listProductSetsAsync" - ] - }, - "ListProducts": { - "methods": [ - "listProducts", - "listProductsStream", - "listProductsAsync" - ] - }, - "ListReferenceImages": { - "methods": [ - "listReferenceImages", - "listReferenceImagesStream", - "listReferenceImagesAsync" - ] - }, - "ListProductsInProductSet": { - "methods": [ - "listProductsInProductSet", - "listProductsInProductSetStream", - "listProductsInProductSetAsync" - ] - } - } - } - } - } - } -} diff --git a/src/v1p3beta1/image_annotator_client.ts b/src/v1p3beta1/image_annotator_client.ts deleted file mode 100644 index 98a32465..00000000 --- a/src/v1p3beta1/image_annotator_client.ts +++ /dev/null @@ -1,803 +0,0 @@ -// Copyright 2023 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p3beta1/image_annotator_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -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 _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - imageAnnotatorStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ImageAnnotatorClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ImageAnnotatorClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // 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 this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // 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 lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .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 this._gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateFilesResponse.decode.bind( - asyncBatchAnnotateFilesResponse - ), - asyncBatchAnnotateFilesMetadata.decode.bind( - asyncBatchAnnotateFilesMetadata - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.imageAnnotatorStub) { - return this.imageAnnotatorStub; - } - - // Put together the "service stub" for - // google.cloud.vision.v1p3beta1.ImageAnnotator. - this.imageAnnotatorStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.vision.v1p3beta1.ImageAnnotator' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vision.v1p3beta1.ImageAnnotator, - this._opts, - this._providedCustomServicePath - ) 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 callPromise = this.imageAnnotatorStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = this.descriptors.longrunning[methodName] || undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.imageAnnotatorStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - 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. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/image_annotator.batch_annotate_images.js - * region_tag:vision_v1p3beta1_generated_ImageAnnotator_BatchAnnotateImages_async - */ - batchAnnotateImages( - request?: protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, - ( - | protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest - | undefined - ), - {} | undefined - ] - >; - batchAnnotateImages( - request: protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request: protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request?: protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, - ( - | protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - 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 {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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/image_annotator.async_batch_annotate_files.js - * region_tag:vision_v1p3beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async - */ - asyncBatchAnnotateFiles( - request?: protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - asyncBatchAnnotateFiles( - request: protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateFiles( - request: protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateFiles( - request?: protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.asyncBatchAnnotateFiles( - request, - options, - callback - ); - } - /** - * Check the status of the long running operation returned by `asyncBatchAnnotateFiles()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/image_annotator.async_batch_annotate_files.js - * region_tag:vision_v1p3beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async - */ - async checkAsyncBatchAnnotateFilesProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.asyncBatchAnnotateFiles, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.OperationMetadata - >; - } - // -------------------- - // -- 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: project, - location: location, - product: 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: project, - location: 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: project, - location: location, - product: 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. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.imageAnnotatorStub && !this._terminated) { - return this.imageAnnotatorStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} -import {FeaturesMethod} from '../helpers'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/src/v1p3beta1/image_annotator_client_config.json b/src/v1p3beta1/image_annotator_client_config.json deleted file mode 100644 index 75a2b706..00000000 --- a/src/v1p3beta1/image_annotator_client_config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "interfaces": { - "google.cloud.vision.v1p3beta1.ImageAnnotator": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "BatchAnnotateImages": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AsyncBatchAnnotateFiles": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/src/v1p3beta1/image_annotator_proto_list.json b/src/v1p3beta1/image_annotator_proto_list.json deleted file mode 100644 index f5f413b6..00000000 --- a/src/v1p3beta1/image_annotator_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../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/src/v1p3beta1/index.ts b/src/v1p3beta1/index.ts deleted file mode 100644 index 4cbdef94..00000000 --- a/src/v1p3beta1/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2023 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/src/v1p3beta1/product_search_client.ts b/src/v1p3beta1/product_search_client.ts deleted file mode 100644 index d401a753..00000000 --- a/src/v1p3beta1/product_search_client.ts +++ /dev/null @@ -1,3029 +0,0 @@ -// Copyright 2023 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, - PaginationCallback, - GaxCall, -} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p3beta1/product_search_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -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 {@link google.cloud.vision.v1p3beta1.ProductSet|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 {@link google.cloud.vision.v1p3beta1.Product|Product} resources, named - * `projects/* /locations/* /products/*` - * - * - Each {@link google.cloud.vision.v1p3beta1.Product|Product} has a collection of {@link google.cloud.vision.v1p3beta1.ReferenceImage|ReferenceImage} resources, named - * `projects/* /locations/* /products/* /referenceImages/*` - * @class - * @memberof v1p3beta1 - */ -export class ProductSearchClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - productSearchStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProductSearchClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ProductSearchClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProductSearchClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // 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 this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new this._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 this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'productSets' - ), - listProducts: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - listReferenceImages: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'referenceImages' - ), - listProductsInProductSet: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // 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 lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .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 this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importProductSetsResponse.decode.bind(importProductSetsResponse), - importProductSetsMetadata.decode.bind(importProductSetsMetadata) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.productSearchStub) { - return this.productSearchStub; - } - - // Put together the "service stub" for - // google.cloud.vision.v1p3beta1.ProductSearch. - this.productSearchStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.vision.v1p3beta1.ProductSearch' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vision.v1p3beta1.ProductSearch, - this._opts, - this._providedCustomServicePath - ) 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 callPromise = this.productSearchStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.productSearchStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - 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. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.create_product_set.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_CreateProductSet_async - */ - createProductSet( - request?: protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProductSet, - protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest | undefined, - {} | undefined - ] - >; - createProductSet( - request: protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProductSet( - request: protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProductSet( - request?: protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProductSet, - protos.google.cloud.vision.v1p3beta1.ICreateProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createProductSet(request, options, callback); - } - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.get_product_set.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_GetProductSet_async - */ - getProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProductSet, - protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest | undefined, - {} | undefined - ] - >; - getProductSet( - request: protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getProductSet( - request: protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProductSet, - protos.google.cloud.vision.v1p3beta1.IGetProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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 {@link google.protobuf.FieldMask|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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.update_product_set.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_UpdateProductSet_async - */ - updateProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProductSet, - protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest | undefined, - {} | undefined - ] - >; - updateProductSet( - request: protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProductSet( - request: protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IProductSet, - | protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProductSet, - protos.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'product_set.name': request.productSet!.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.delete_product_set.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_DeleteProductSet_async - */ - deleteProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest | undefined, - {} | undefined - ] - >; - deleteProductSet( - request: protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProductSet( - request: protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.create_product.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_CreateProduct_async - */ - createProduct( - request?: protos.google.cloud.vision.v1p3beta1.ICreateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct, - protos.google.cloud.vision.v1p3beta1.ICreateProductRequest | undefined, - {} | undefined - ] - >; - createProduct( - request: protos.google.cloud.vision.v1p3beta1.ICreateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProduct( - request: protos.google.cloud.vision.v1p3beta1.ICreateProductRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProduct( - request?: protos.google.cloud.vision.v1p3beta1.ICreateProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct, - protos.google.cloud.vision.v1p3beta1.ICreateProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createProduct(request, options, callback); - } - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.get_product.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_GetProduct_async - */ - getProduct( - request?: protos.google.cloud.vision.v1p3beta1.IGetProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct, - protos.google.cloud.vision.v1p3beta1.IGetProductRequest | undefined, - {} | undefined - ] - >; - getProduct( - request: protos.google.cloud.vision.v1p3beta1.IGetProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.IGetProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getProduct( - request: protos.google.cloud.vision.v1p3beta1.IGetProductRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.IGetProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getProduct( - request?: protos.google.cloud.vision.v1p3beta1.IGetProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.IGetProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.IGetProductRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct, - protos.google.cloud.vision.v1p3beta1.IGetProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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 {@link google.protobuf.FieldMask|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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.update_product.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_UpdateProduct_async - */ - updateProduct( - request?: protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct, - protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest | undefined, - {} | undefined - ] - >; - updateProduct( - request: protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request: protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request?: protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IProduct, - | protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct, - protos.google.cloud.vision.v1p3beta1.IUpdateProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'product.name': request.product!.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.delete_product.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_DeleteProduct_async - */ - deleteProduct( - request?: protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest | undefined, - {} | undefined - ] - >; - deleteProduct( - request: protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request: protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request?: protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p3beta1.IDeleteProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.create_reference_image.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_CreateReferenceImage_async - */ - createReferenceImage( - request?: protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - ( - | protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest - | undefined - ), - {} | undefined - ] - >; - createReferenceImage( - request: protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - | protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createReferenceImage( - request: protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - | protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createReferenceImage( - request?: protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - | protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - | protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - ( - | protos.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.delete_reference_image.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_DeleteReferenceImage_async - */ - deleteReferenceImage( - request?: protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest - | undefined - ), - {} | undefined - ] - >; - deleteReferenceImage( - request: protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteReferenceImage( - request: protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteReferenceImage( - request?: protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteReferenceImage(request, options, callback); - } - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.get_reference_image.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_GetReferenceImage_async - */ - getReferenceImage( - request?: protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - ( - | protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest - | undefined - ), - {} | undefined - ] - >; - getReferenceImage( - request: protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - | protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getReferenceImage( - request: protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, - callback: Callback< - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - | protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getReferenceImage( - request?: protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - | protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - | protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IReferenceImage, - ( - | protos.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.add_product_to_product_set.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_AddProductToProductSet_async - */ - addProductToProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest - | undefined - ), - {} | undefined - ] - >; - addProductToProductSet( - request: protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - addProductToProductSet( - request: protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - addProductToProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.remove_product_from_product_set.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_RemoveProductFromProductSet_async - */ - removeProductFromProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest - | undefined - ), - {} | undefined - ] - >; - removeProductFromProductSet( - request: protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - removeProductFromProductSet( - request: protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - removeProductFromProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.removeProductFromProductSet( - request, - options, - callback - ); - } - - /** - * Asynchronous API that imports a list of reference images to specified - * product sets based on a list of image information. - * - * The {@link 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 - * {@link google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri|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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.import_product_sets.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_ImportProductSets_async - */ - importProductSets( - request?: protos.google.cloud.vision.v1p3beta1.IImportProductSetsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - importProductSets( - request: protos.google.cloud.vision.v1p3beta1.IImportProductSetsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProductSets( - request: protos.google.cloud.vision.v1p3beta1.IImportProductSetsRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProductSets( - request?: protos.google.cloud.vision.v1p3beta1.IImportProductSetsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importProductSets(request, options, callback); - } - /** - * Check the status of the long running operation returned by `importProductSets()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.import_product_sets.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_ImportProductSets_async - */ - async checkImportProductSetsProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1p3beta1.ImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.BatchOperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.importProductSets, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1p3beta1.ImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.BatchOperationMetadata - >; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductSetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductSets( - request?: protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProductSet[], - protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest | null, - protos.google.cloud.vision.v1p3beta1.IListProductSetsResponse - ] - >; - listProductSets( - request: protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProductSet - > - ): void; - listProductSets( - request: protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProductSet - > - ): void; - listProductSets( - request?: protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProductSet - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProductSet - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProductSet[], - protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest | null, - protos.google.cloud.vision.v1p3beta1.IListProductSetsResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProductSets(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductSetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductSetsStream( - request?: protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProductSets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductSets.createStream( - this.innerApiCalls.listProductSets as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProductSets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.list_product_sets.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_ListProductSets_async - */ - listProductSetsAsync( - request?: protos.google.cloud.vision.v1p3beta1.IListProductSetsRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProductSets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductSets.asyncIterate( - this.innerApiCalls['listProductSets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProducts( - request?: protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct[], - protos.google.cloud.vision.v1p3beta1.IListProductsRequest | null, - protos.google.cloud.vision.v1p3beta1.IListProductsResponse - ] - >; - listProducts( - request: protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProduct - > - ): void; - listProducts( - request: protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProduct - > - ): void; - listProducts( - request?: protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProduct - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProduct - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct[], - protos.google.cloud.vision.v1p3beta1.IListProductsRequest | null, - protos.google.cloud.vision.v1p3beta1.IListProductsResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProducts(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsStream( - request?: protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProducts.createStream( - this.innerApiCalls.listProducts as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProducts`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Product]{@link google.cloud.vision.v1p3beta1.Product}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.list_products.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_ListProducts_async - */ - listProductsAsync( - request?: protos.google.cloud.vision.v1p3beta1.IListProductsRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProducts.asyncIterate( - this.innerApiCalls['listProducts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listReferenceImagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listReferenceImages( - request?: protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IReferenceImage[], - protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest | null, - protos.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse - ] - >; - listReferenceImages( - request: protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IReferenceImage - > - ): void; - listReferenceImages( - request: protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IReferenceImage - > - ): void; - listReferenceImages( - request?: protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IReferenceImage - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IReferenceImage - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IReferenceImage[], - protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest | null, - protos.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listReferenceImages(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listReferenceImagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listReferenceImagesStream( - request?: protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listReferenceImages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReferenceImages.createStream( - this.innerApiCalls.listReferenceImages as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listReferenceImages`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.list_reference_images.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_ListReferenceImages_async - */ - listReferenceImagesAsync( - request?: protos.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listReferenceImages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReferenceImages.asyncIterate( - this.innerApiCalls['listReferenceImages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductsInProductSetAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsInProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct[], - protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest | null, - protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse - ] - >; - listProductsInProductSet( - request: protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProduct - > - ): void; - listProductsInProductSet( - request: protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProduct - > - ): void; - listProductsInProductSet( - request?: protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProduct - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1p3beta1.IProduct - > - ): Promise< - [ - protos.google.cloud.vision.v1p3beta1.IProduct[], - protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest | null, - protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProductsInProductSet( - request, - options, - callback - ); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductsInProductSetAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsInProductSetStream( - request?: protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - const defaultCallSettings = this._defaults['listProductsInProductSet']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductsInProductSet.createStream( - this.innerApiCalls.listProductsInProductSet as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProductsInProductSet`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Product]{@link google.cloud.vision.v1p3beta1.Product}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p3beta1/product_search.list_products_in_product_set.js - * region_tag:vision_v1p3beta1_generated_ProductSearch_ListProductsInProductSet_async - */ - listProductsInProductSetAsync( - request?: protos.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - const defaultCallSettings = this._defaults['listProductsInProductSet']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductsInProductSet.asyncIterate( - this.innerApiCalls['listProductsInProductSet'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- 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: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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: project, - location: location, - product: 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: project, - location: 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: project, - location: location, - product: 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. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.productSearchStub && !this._terminated) { - return this.productSearchStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/src/v1p3beta1/product_search_client_config.json b/src/v1p3beta1/product_search_client_config.json deleted file mode 100644 index ddc1e9ad..00000000 --- a/src/v1p3beta1/product_search_client_config.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "interfaces": { - "google.cloud.vision.v1p3beta1.ProductSearch": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListProductSets": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateProduct": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListProducts": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetProduct": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateProduct": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteProduct": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListReferenceImages": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AddProductToProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RemoveProductFromProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListProductsInProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ImportProductSets": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/src/v1p3beta1/product_search_proto_list.json b/src/v1p3beta1/product_search_proto_list.json deleted file mode 100644 index f5f413b6..00000000 --- a/src/v1p3beta1/product_search_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../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/src/v1p4beta1/gapic_metadata.json b/src/v1p4beta1/gapic_metadata.json deleted file mode 100644 index 8338e641..00000000 --- a/src/v1p4beta1/gapic_metadata.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.vision.v1p4beta1", - "libraryPackage": "@google-cloud/vision", - "services": { - "ImageAnnotator": { - "clients": { - "grpc": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - }, - "BatchAnnotateFiles": { - "methods": [ - "batchAnnotateFiles" - ] - }, - "AsyncBatchAnnotateImages": { - "methods": [ - "asyncBatchAnnotateImages" - ] - }, - "AsyncBatchAnnotateFiles": { - "methods": [ - "asyncBatchAnnotateFiles" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ImageAnnotatorClient", - "rpcs": { - "BatchAnnotateImages": { - "methods": [ - "batchAnnotateImages" - ] - }, - "BatchAnnotateFiles": { - "methods": [ - "batchAnnotateFiles" - ] - }, - "AsyncBatchAnnotateImages": { - "methods": [ - "asyncBatchAnnotateImages" - ] - }, - "AsyncBatchAnnotateFiles": { - "methods": [ - "asyncBatchAnnotateFiles" - ] - } - } - } - } - }, - "ProductSearch": { - "clients": { - "grpc": { - "libraryClient": "ProductSearchClient", - "rpcs": { - "CreateProductSet": { - "methods": [ - "createProductSet" - ] - }, - "GetProductSet": { - "methods": [ - "getProductSet" - ] - }, - "UpdateProductSet": { - "methods": [ - "updateProductSet" - ] - }, - "DeleteProductSet": { - "methods": [ - "deleteProductSet" - ] - }, - "CreateProduct": { - "methods": [ - "createProduct" - ] - }, - "GetProduct": { - "methods": [ - "getProduct" - ] - }, - "UpdateProduct": { - "methods": [ - "updateProduct" - ] - }, - "DeleteProduct": { - "methods": [ - "deleteProduct" - ] - }, - "CreateReferenceImage": { - "methods": [ - "createReferenceImage" - ] - }, - "DeleteReferenceImage": { - "methods": [ - "deleteReferenceImage" - ] - }, - "GetReferenceImage": { - "methods": [ - "getReferenceImage" - ] - }, - "AddProductToProductSet": { - "methods": [ - "addProductToProductSet" - ] - }, - "RemoveProductFromProductSet": { - "methods": [ - "removeProductFromProductSet" - ] - }, - "ImportProductSets": { - "methods": [ - "importProductSets" - ] - }, - "PurgeProducts": { - "methods": [ - "purgeProducts" - ] - }, - "ListProductSets": { - "methods": [ - "listProductSets", - "listProductSetsStream", - "listProductSetsAsync" - ] - }, - "ListProducts": { - "methods": [ - "listProducts", - "listProductsStream", - "listProductsAsync" - ] - }, - "ListReferenceImages": { - "methods": [ - "listReferenceImages", - "listReferenceImagesStream", - "listReferenceImagesAsync" - ] - }, - "ListProductsInProductSet": { - "methods": [ - "listProductsInProductSet", - "listProductsInProductSetStream", - "listProductsInProductSetAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ProductSearchClient", - "rpcs": { - "CreateProductSet": { - "methods": [ - "createProductSet" - ] - }, - "GetProductSet": { - "methods": [ - "getProductSet" - ] - }, - "UpdateProductSet": { - "methods": [ - "updateProductSet" - ] - }, - "DeleteProductSet": { - "methods": [ - "deleteProductSet" - ] - }, - "CreateProduct": { - "methods": [ - "createProduct" - ] - }, - "GetProduct": { - "methods": [ - "getProduct" - ] - }, - "UpdateProduct": { - "methods": [ - "updateProduct" - ] - }, - "DeleteProduct": { - "methods": [ - "deleteProduct" - ] - }, - "CreateReferenceImage": { - "methods": [ - "createReferenceImage" - ] - }, - "DeleteReferenceImage": { - "methods": [ - "deleteReferenceImage" - ] - }, - "GetReferenceImage": { - "methods": [ - "getReferenceImage" - ] - }, - "AddProductToProductSet": { - "methods": [ - "addProductToProductSet" - ] - }, - "RemoveProductFromProductSet": { - "methods": [ - "removeProductFromProductSet" - ] - }, - "ImportProductSets": { - "methods": [ - "importProductSets" - ] - }, - "PurgeProducts": { - "methods": [ - "purgeProducts" - ] - }, - "ListProductSets": { - "methods": [ - "listProductSets", - "listProductSetsStream", - "listProductSetsAsync" - ] - }, - "ListProducts": { - "methods": [ - "listProducts", - "listProductsStream", - "listProductsAsync" - ] - }, - "ListReferenceImages": { - "methods": [ - "listReferenceImages", - "listReferenceImagesStream", - "listReferenceImagesAsync" - ] - }, - "ListProductsInProductSet": { - "methods": [ - "listProductsInProductSet", - "listProductsInProductSetStream", - "listProductsInProductSetAsync" - ] - } - } - } - } - } - } -} diff --git a/src/v1p4beta1/image_annotator_client.ts b/src/v1p4beta1/image_annotator_client.ts deleted file mode 100644 index d5708514..00000000 --- a/src/v1p4beta1/image_annotator_client.ts +++ /dev/null @@ -1,1068 +0,0 @@ -// Copyright 2023 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p4beta1/image_annotator_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -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 _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - imageAnnotatorStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ImageAnnotatorClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ImageAnnotatorClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // 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 this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // 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 lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .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 this._gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateImagesResponse.decode.bind( - asyncBatchAnnotateImagesResponse - ), - asyncBatchAnnotateImagesMetadata.decode.bind( - asyncBatchAnnotateImagesMetadata - ) - ), - asyncBatchAnnotateFiles: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateFilesResponse.decode.bind( - asyncBatchAnnotateFilesResponse - ), - asyncBatchAnnotateFilesMetadata.decode.bind( - asyncBatchAnnotateFilesMetadata - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.imageAnnotatorStub) { - return this.imageAnnotatorStub; - } - - // Put together the "service stub" for - // google.cloud.vision.v1p4beta1.ImageAnnotator. - this.imageAnnotatorStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.vision.v1p4beta1.ImageAnnotator' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vision.v1p4beta1.ImageAnnotator, - this._opts, - this._providedCustomServicePath - ) 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 callPromise = this.imageAnnotatorStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = this.descriptors.longrunning[methodName] || undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.imageAnnotatorStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - 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. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/image_annotator.batch_annotate_images.js - * region_tag:vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateImages_async - */ - batchAnnotateImages( - request?: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, - ( - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest - | undefined - ), - {} | undefined - ] - >; - batchAnnotateImages( - request: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateImages( - request?: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, - ( - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/image_annotator.batch_annotate_files.js - * region_tag:vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateFiles_async - */ - batchAnnotateFiles( - request?: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, - ( - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest - | undefined - ), - {} | undefined - ] - >; - batchAnnotateFiles( - request: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateFiles( - request: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest - | null - | undefined, - {} | null | undefined - > - ): void; - batchAnnotateFiles( - request?: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, - ( - | protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - 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 {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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/image_annotator.async_batch_annotate_images.js - * region_tag:vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async - */ - asyncBatchAnnotateImages( - request?: protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - asyncBatchAnnotateImages( - request: protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateImages( - request: protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateImages( - request?: protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.asyncBatchAnnotateImages( - request, - options, - callback - ); - } - /** - * Check the status of the long running operation returned by `asyncBatchAnnotateImages()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/image_annotator.async_batch_annotate_images.js - * region_tag:vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async - */ - async checkAsyncBatchAnnotateImagesProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.asyncBatchAnnotateImages, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.OperationMetadata - >; - } - /** - * 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/image_annotator.async_batch_annotate_files.js - * region_tag:vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async - */ - asyncBatchAnnotateFiles( - request?: protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - asyncBatchAnnotateFiles( - request: protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateFiles( - request: protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - asyncBatchAnnotateFiles( - request?: protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize(); - return this.innerApiCalls.asyncBatchAnnotateFiles( - request, - options, - callback - ); - } - /** - * Check the status of the long running operation returned by `asyncBatchAnnotateFiles()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/image_annotator.async_batch_annotate_files.js - * region_tag:vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async - */ - async checkAsyncBatchAnnotateFilesProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.OperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.asyncBatchAnnotateFiles, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.OperationMetadata - >; - } - // -------------------- - // -- 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: project, - location: location, - product: 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: project, - location: 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: project, - location: location, - product: 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. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.imageAnnotatorStub && !this._terminated) { - return this.imageAnnotatorStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} -import {FeaturesMethod} from '../helpers'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/src/v1p4beta1/image_annotator_client_config.json b/src/v1p4beta1/image_annotator_client_config.json deleted file mode 100644 index e068ba98..00000000 --- a/src/v1p4beta1/image_annotator_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.vision.v1p4beta1.ImageAnnotator": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "BatchAnnotateImages": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchAnnotateFiles": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AsyncBatchAnnotateImages": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AsyncBatchAnnotateFiles": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/src/v1p4beta1/image_annotator_proto_list.json b/src/v1p4beta1/image_annotator_proto_list.json deleted file mode 100644 index 04693e04..00000000 --- a/src/v1p4beta1/image_annotator_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../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/src/v1p4beta1/index.ts b/src/v1p4beta1/index.ts deleted file mode 100644 index 4cbdef94..00000000 --- a/src/v1p4beta1/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2023 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/src/v1p4beta1/product_search_client.ts b/src/v1p4beta1/product_search_client.ts deleted file mode 100644 index 226d479f..00000000 --- a/src/v1p4beta1/product_search_client.ts +++ /dev/null @@ -1,3203 +0,0 @@ -// Copyright 2023 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - GrpcClientOptions, - LROperation, - PaginationCallback, - GaxCall, -} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p4beta1/product_search_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -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 - * {@link google.cloud.vision.v1p4beta1.ProductSet|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 - * {@link google.cloud.vision.v1p4beta1.Product|Product} resources, named - * `projects/* /locations/* /products/*` - * - * - Each {@link google.cloud.vision.v1p4beta1.Product|Product} has a collection of - * {@link google.cloud.vision.v1p4beta1.ReferenceImage|ReferenceImage} resources, - * named - * `projects/* /locations/* /products/* /referenceImages/*` - * @class - * @memberof v1p4beta1 - */ -export class ProductSearchClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - productSearchStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProductSearchClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @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 {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ProductSearchClient({fallback: 'rest'}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProductSearchClient; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest') { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // 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 this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new this._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 this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'productSets' - ), - listProducts: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - listReferenceImages: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'referenceImages' - ), - listProductsInProductSet: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // 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 lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .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 this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importProductSetsResponse.decode.bind(importProductSetsResponse), - importProductSetsMetadata.decode.bind(importProductSetsMetadata) - ), - purgeProducts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - purgeProductsResponse.decode.bind(purgeProductsResponse), - purgeProductsMetadata.decode.bind(purgeProductsMetadata) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._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 = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.productSearchStub) { - return this.productSearchStub; - } - - // Put together the "service stub" for - // google.cloud.vision.v1p4beta1.ProductSearch. - this.productSearchStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.vision.v1p4beta1.ProductSearch' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.vision.v1p4beta1.ProductSearch, - this._opts, - this._providedCustomServicePath - ) 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 callPromise = this.productSearchStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - } - ); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.productSearchStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - 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. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.create_product_set.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_CreateProductSet_async - */ - createProductSet( - request?: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProductSet, - protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | undefined, - {} | undefined - ] - >; - createProductSet( - request: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProductSet( - request: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProductSet( - request?: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProductSet, - protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createProductSet(request, options, callback); - } - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.get_product_set.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_GetProductSet_async - */ - getProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProductSet, - protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest | undefined, - {} | undefined - ] - >; - getProductSet( - request: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getProductSet( - request: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProductSet, - protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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 {@link google.protobuf.FieldMask|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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.update_product_set.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_UpdateProductSet_async - */ - updateProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProductSet, - protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest | undefined, - {} | undefined - ] - >; - updateProductSet( - request: protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProductSet( - request: protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IProductSet, - | protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProductSet, - protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'product_set.name': request.productSet!.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.delete_product_set.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_DeleteProductSet_async - */ - deleteProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | undefined, - {} | undefined - ] - >; - deleteProductSet( - request: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProductSet( - request: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.create_product.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_CreateProduct_async - */ - createProduct( - request?: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct, - protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | undefined, - {} | undefined - ] - >; - createProduct( - request: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProduct( - request: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createProduct( - request?: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.ICreateProductRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct, - protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createProduct(request, options, callback); - } - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.get_product.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_GetProduct_async - */ - getProduct( - request?: protos.google.cloud.vision.v1p4beta1.IGetProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct, - protos.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined, - {} | undefined - ] - >; - getProduct( - request: protos.google.cloud.vision.v1p4beta1.IGetProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.IGetProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getProduct( - request: protos.google.cloud.vision.v1p4beta1.IGetProductRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.IGetProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getProduct( - request?: protos.google.cloud.vision.v1p4beta1.IGetProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.IGetProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.IGetProductRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct, - protos.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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 {@link google.protobuf.FieldMask|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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.update_product.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_UpdateProduct_async - */ - updateProduct( - request?: protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct, - protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest | undefined, - {} | undefined - ] - >; - updateProduct( - request: protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request: protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProduct( - request?: protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IProduct, - | protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct, - protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'product.name': request.product!.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.delete_product.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_DeleteProduct_async - */ - deleteProduct( - request?: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | undefined, - {} | undefined - ] - >; - deleteProduct( - request: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteProduct( - request?: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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 {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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.create_reference_image.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_CreateReferenceImage_async - */ - createReferenceImage( - request?: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - ( - | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest - | undefined - ), - {} | undefined - ] - >; - createReferenceImage( - request: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createReferenceImage( - request: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createReferenceImage( - request?: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - ( - | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.delete_reference_image.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_DeleteReferenceImage_async - */ - deleteReferenceImage( - request?: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest - | undefined - ), - {} | undefined - ] - >; - deleteReferenceImage( - request: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteReferenceImage( - request: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteReferenceImage( - request?: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteReferenceImage(request, options, callback); - } - /** - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.get_reference_image.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_GetReferenceImage_async - */ - getReferenceImage( - request?: protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - ( - | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest - | undefined - ), - {} | undefined - ] - >; - getReferenceImage( - request: protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getReferenceImage( - request: protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, - callback: Callback< - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getReferenceImage( - request?: protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IReferenceImage, - ( - | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.add_product_to_product_set.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_AddProductToProductSet_async - */ - addProductToProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest - | undefined - ), - {} | undefined - ] - >; - addProductToProductSet( - request: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - addProductToProductSet( - request: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - addProductToProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - 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] - * 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}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.remove_product_from_product_set.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_RemoveProductFromProductSet_async - */ - removeProductFromProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest - | undefined - ), - {} | undefined - ] - >; - removeProductFromProductSet( - request: protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - removeProductFromProductSet( - request: protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): void; - removeProductFromProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.removeProductFromProductSet( - request, - options, - callback - ); - } - - /** - * Asynchronous API that imports a list of reference images to specified - * product sets based on a list of image information. - * - * The {@link 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 - * {@link google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri|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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.import_product_sets.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_ImportProductSets_async - */ - importProductSets( - request?: protos.google.cloud.vision.v1p4beta1.IImportProductSetsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - importProductSets( - request: protos.google.cloud.vision.v1p4beta1.IImportProductSetsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProductSets( - request: protos.google.cloud.vision.v1p4beta1.IImportProductSetsRequest, - callback: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - importProductSets( - request?: protos.google.cloud.vision.v1p4beta1.IImportProductSetsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.importProductSets(request, options, callback); - } - /** - * Check the status of the long running operation returned by `importProductSets()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.import_product_sets.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_ImportProductSets_async - */ - async checkImportProductSetsProgress( - name: string - ): Promise< - LROperation< - protos.google.cloud.vision.v1p4beta1.ImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.importProductSets, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.vision.v1p4beta1.ImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata - >; - } - /** - * 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 {@link 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.purge_products.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_PurgeProducts_async - */ - purgeProducts( - request?: protos.google.cloud.vision.v1p4beta1.IPurgeProductsRequest, - options?: CallOptions - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - purgeProducts( - request: protos.google.cloud.vision.v1p4beta1.IPurgeProductsRequest, - options: CallOptions, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - purgeProducts( - request: protos.google.cloud.vision.v1p4beta1.IPurgeProductsRequest, - callback: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): void; - purgeProducts( - request?: protos.google.cloud.vision.v1p4beta1.IPurgeProductsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - >, - callback?: Callback< - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, - {} | null | undefined - > - ): Promise< - [ - LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.purgeProducts(request, options, callback); - } - /** - * Check the status of the long running operation returned by `purgeProducts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.purge_products.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_PurgeProducts_async - */ - async checkPurgeProductsProgress( - name: string - ): Promise< - LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata - > - > { - const request = - new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation( - operation, - this.descriptors.longrunning.purgeProducts, - this._gaxModule.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.protobuf.Empty, - protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata - >; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductSetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductSets( - request?: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProductSet[], - protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null, - protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse - ] - >; - listProductSets( - request: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProductSet - > - ): void; - listProductSets( - request: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProductSet - > - ): void; - listProductSets( - request?: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProductSet - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProductSet - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProductSet[], - protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null, - protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProductSets(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductSetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductSetsStream( - request?: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProductSets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductSets.createStream( - this.innerApiCalls.listProductSets as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProductSets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.list_product_sets.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_ListProductSets_async - */ - listProductSetsAsync( - request?: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProductSets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductSets.asyncIterate( - this.innerApiCalls['listProductSets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProducts( - request?: protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct[], - protos.google.cloud.vision.v1p4beta1.IListProductsRequest | null, - protos.google.cloud.vision.v1p4beta1.IListProductsResponse - ] - >; - listProducts( - request: protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProduct - > - ): void; - listProducts( - request: protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProduct - > - ): void; - listProducts( - request?: protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProduct - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductsResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProduct - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct[], - protos.google.cloud.vision.v1p4beta1.IListProductsRequest | null, - protos.google.cloud.vision.v1p4beta1.IListProductsResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProducts(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsStream( - request?: protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProducts.createStream( - this.innerApiCalls.listProducts as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProducts`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Product]{@link google.cloud.vision.v1p4beta1.Product}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.list_products.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_ListProducts_async - */ - listProductsAsync( - request?: protos.google.cloud.vision.v1p4beta1.IListProductsRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProducts.asyncIterate( - this.innerApiCalls['listProducts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listReferenceImagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listReferenceImages( - request?: protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IReferenceImage[], - protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest | null, - protos.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse - ] - >; - listReferenceImages( - request: protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IReferenceImage - > - ): void; - listReferenceImages( - request: protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IReferenceImage - > - ): void; - listReferenceImages( - request?: protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IReferenceImage - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - | protos.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IReferenceImage - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IReferenceImage[], - protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest | null, - protos.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listReferenceImages(request, options, callback); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. 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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listReferenceImagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listReferenceImagesStream( - request?: protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listReferenceImages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReferenceImages.createStream( - this.innerApiCalls.listReferenceImages as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listReferenceImages`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. 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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.list_reference_images.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_ListReferenceImages_async - */ - listReferenceImagesAsync( - request?: protos.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listReferenceImages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listReferenceImages.asyncIterate( - this.innerApiCalls['listReferenceImages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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 will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductsInProductSetAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsInProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct[], - protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest | null, - protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse - ] - >; - listProductsInProductSet( - request: protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProduct - > - ): void; - listProductsInProductSet( - request: protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - callback: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProduct - > - ): void; - listProductsInProductSet( - request?: protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProduct - >, - callback?: PaginationCallback< - protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - | protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse - | null - | undefined, - protos.google.cloud.vision.v1p4beta1.IProduct - > - ): Promise< - [ - protos.google.cloud.vision.v1p4beta1.IProduct[], - protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest | null, - protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listProductsInProductSet( - request, - options, - callback - ); - } - - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProductsInProductSetAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listProductsInProductSetStream( - request?: protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - const defaultCallSettings = this._defaults['listProductsInProductSet']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductsInProductSet.createStream( - this.innerApiCalls.listProductsInProductSet as GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listProductsInProductSet`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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 {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Product]{@link google.cloud.vision.v1p4beta1.Product}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p4beta1/product_search.list_products_in_product_set.js - * region_tag:vision_v1p4beta1_generated_ProductSearch_ListProductsInProductSet_async - */ - listProductsInProductSetAsync( - request?: protos.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - const defaultCallSettings = this._defaults['listProductsInProductSet']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listProductsInProductSet.asyncIterate( - this.innerApiCalls['listProductsInProductSet'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- 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: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified 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: project, - location: location, - product: 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: project, - location: 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: project, - location: location, - product: 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. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.productSearchStub && !this._terminated) { - return this.productSearchStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/src/v1p4beta1/product_search_client_config.json b/src/v1p4beta1/product_search_client_config.json deleted file mode 100644 index 518529b7..00000000 --- a/src/v1p4beta1/product_search_client_config.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "interfaces": { - "google.cloud.vision.v1p4beta1.ProductSearch": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListProductSets": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateProduct": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListProducts": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetProduct": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateProduct": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteProduct": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListReferenceImages": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetReferenceImage": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "AddProductToProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RemoveProductFromProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListProductsInProductSet": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ImportProductSets": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PurgeProducts": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/src/v1p4beta1/product_search_proto_list.json b/src/v1p4beta1/product_search_proto_list.json deleted file mode 100644 index 04693e04..00000000 --- a/src/v1p4beta1/product_search_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../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/system-test/.eslintrc.yml b/system-test/.eslintrc.yml deleted file mode 100644 index 4721890f..00000000 --- a/system-test/.eslintrc.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -rules: - no-console: off - node/no-unsupported-features/es-syntax: off diff --git a/system-test/data/document.jpg b/system-test/data/document.jpg deleted file mode 100644 index 9152604f..00000000 Binary files a/system-test/data/document.jpg and /dev/null differ diff --git a/system-test/data/logo.jpg b/system-test/data/logo.jpg deleted file mode 100644 index f166dc65..00000000 Binary files a/system-test/data/logo.jpg and /dev/null differ diff --git a/system-test/data/rushmore.jpg b/system-test/data/rushmore.jpg deleted file mode 100644 index 5bf03b34..00000000 Binary files a/system-test/data/rushmore.jpg and /dev/null differ diff --git a/system-test/data/text.png b/system-test/data/text.png deleted file mode 100644 index 134a0c52..00000000 Binary files a/system-test/data/text.png and /dev/null differ diff --git a/system-test/fixtures/sample/src/index.js b/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 812e2cb5..00000000 --- a/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 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. ** - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const vision = require('@google-cloud/vision'); - -function main() { - const imageAnnotatorClient = new vision.ImageAnnotatorClient(); - const productSearchClient = new vision.ProductSearchClient(); -} - -main(); diff --git a/system-test/fixtures/sample/src/index.ts b/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 1ec26c80..00000000 --- a/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2023 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'; - -// check that the client class type name can be used -function doStuffWithImageAnnotatorClient(client: ImageAnnotatorClient) { - client.close(); -} -function doStuffWithProductSearchClient(client: ProductSearchClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const imageAnnotatorClient = new ImageAnnotatorClient(); - doStuffWithImageAnnotatorClient(imageAnnotatorClient); - // check that the client instance can be created - const productSearchClient = new ProductSearchClient(); - doStuffWithProductSearchClient(productSearchClient); -} - -main(); diff --git a/system-test/image_annotator_smoke_test.ts b/system-test/image_annotator_smoke_test.ts deleted file mode 100644 index a5aae161..00000000 --- a/system-test/image_annotator_smoke_test.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2018 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 {describe, it} from 'mocha'; - -describe('ImageAnnotatorSmokeTest', () => { - it('successfully makes a call to the service', done => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const vision = require('../src'); - - const client = new vision.v1p3beta1.ImageAnnotatorClient({ - // optional auth parameters. - }); - - const gcsImageUri = 'gs://gapic-toolkit/President_Barack_Obama.jpg'; - const source = { - gcsImageUri, - }; - const image = { - source, - }; - const type = 'FACE_DETECTION'; - const featuresElement = { - type, - }; - const features = [featuresElement]; - const requestsElement = { - image, - features, - }; - const requests = [requestsElement]; - client - .batchAnnotateImages({requests}) - .then((responses: {[index: number]: string}) => { - const response = responses[0]; - console.log(response); - }) - .then(done) - .catch(done); - }); -}); diff --git a/system-test/install.ts b/system-test/install.ts deleted file mode 100644 index f61fe236..00000000 --- a/system-test/install.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2023 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('📦 pack-n-play test', () => { - it('TypeScript code', async function () { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync( - './system-test/fixtures/sample/src/index.ts' - ).toString(), - }, - }; - await packNTest(options); - }); - - it('JavaScript code', async function () { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync( - './system-test/fixtures/sample/src/index.js' - ).toString(), - }, - }; - await packNTest(options); - }); -}); diff --git a/system-test/vision-v1p2beta1.ts b/system-test/vision-v1p2beta1.ts deleted file mode 100644 index dd45d21e..00000000 --- a/system-test/vision-v1p2beta1.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2018 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 {describe, it} from 'mocha'; - -describe('ImageAnnotatorSmokeTest', () => { - it('successfully makes a call to the service', done => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const vision = require('../src'); - - const client = new vision.v1p2beta1.ImageAnnotatorClient({ - // optional auth parameters. - }); - - const gcsImageUri = 'gs://gapic-toolkit/President_Barack_Obama.jpg'; - const source = { - gcsImageUri, - }; - const image = { - source, - }; - const type = 'FACE_DETECTION'; - const featuresElement = { - type, - }; - const features = [featuresElement]; - const requestsElement = { - image, - features, - }; - const requests = [requestsElement]; - client - .batchAnnotateImages({requests}) - .then((responses: {[index: number]: string}) => { - const response = responses[0]; - console.log(response); - }) - .then(done) - .catch(done); - }); -}); diff --git a/system-test/vision.ts b/system-test/vision.ts deleted file mode 100644 index 8fa98113..00000000 --- a/system-test/vision.ts +++ /dev/null @@ -1,136 +0,0 @@ -// 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'; - -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 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/test/fixtures/image.jpg b/test/fixtures/image.jpg deleted file mode 100644 index e69de29b..00000000 diff --git a/test/gapic_image_annotator_v1.ts b/test/gapic_image_annotator_v1.ts deleted file mode 100644 index 9cbdd105..00000000 --- a/test/gapic_image_annotator_v1.ts +++ /dev/null @@ -1,1063 +0,0 @@ -// Copyright 2023 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 protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as imageannotatorModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v1.ImageAnnotatorClient', () => { - describe('Common methods', () => { - 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); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - await client.initialize(); - assert(client.imageAnnotatorStub); - }); - - it('has close method for the initialized client', done => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.imageAnnotatorStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.BatchAnnotateImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCall(expectedResponse); - const [response] = await client.batchAnnotateImages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.batchAnnotateImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.batchAnnotateImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchAnnotateImages without error using callback', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.BatchAnnotateImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchAnnotateImages( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IBatchAnnotateImagesResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.batchAnnotateImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.batchAnnotateImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchAnnotateImages with error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.BatchAnnotateImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchAnnotateImages = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - const actualRequest = ( - client.innerApiCalls.batchAnnotateImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.batchAnnotateImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchAnnotateImages with closed client', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.BatchAnnotateImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - }); - - describe('batchAnnotateFiles', () => { - it('invokes batchAnnotateFiles without error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateFilesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.BatchAnnotateFilesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateFilesResponse() - ); - client.innerApiCalls.batchAnnotateFiles = - stubSimpleCall(expectedResponse); - const [response] = await client.batchAnnotateFiles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.batchAnnotateFiles as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.batchAnnotateFiles as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchAnnotateFiles without error using callback', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateFilesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.BatchAnnotateFilesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateFilesResponse() - ); - client.innerApiCalls.batchAnnotateFiles = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchAnnotateFiles( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IBatchAnnotateFilesResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.batchAnnotateFiles as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.batchAnnotateFiles as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchAnnotateFiles with error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateFilesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.BatchAnnotateFilesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchAnnotateFiles = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.batchAnnotateFiles(request), expectedError); - const actualRequest = ( - client.innerApiCalls.batchAnnotateFiles as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.batchAnnotateFiles as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchAnnotateFiles with closed client', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.BatchAnnotateFilesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.BatchAnnotateFilesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchAnnotateFiles(request), expectedError); - }); - }); - - describe('asyncBatchAnnotateImages', () => { - it('invokes asyncBatchAnnotateImages without error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateImages = - stubLongRunningCall(expectedResponse); - const [operation] = await client.asyncBatchAnnotateImages(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.asyncBatchAnnotateImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.asyncBatchAnnotateImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asyncBatchAnnotateImages without error using callback', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateImages = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asyncBatchAnnotateImages( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.asyncBatchAnnotateImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.asyncBatchAnnotateImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asyncBatchAnnotateImages with call error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateImages = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.asyncBatchAnnotateImages(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.asyncBatchAnnotateImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.asyncBatchAnnotateImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asyncBatchAnnotateImages with LRO error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateImages = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.asyncBatchAnnotateImages(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.asyncBatchAnnotateImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.asyncBatchAnnotateImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAsyncBatchAnnotateImagesProgress without error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = - await client.checkAsyncBatchAnnotateImagesProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAsyncBatchAnnotateImagesProgress with error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkAsyncBatchAnnotateImagesProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('asyncBatchAnnotateFiles', () => { - it('invokes asyncBatchAnnotateFiles without error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateFiles = - stubLongRunningCall(expectedResponse); - const [operation] = await client.asyncBatchAnnotateFiles(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.asyncBatchAnnotateFiles as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.asyncBatchAnnotateFiles as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asyncBatchAnnotateFiles without error using callback', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateFiles = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asyncBatchAnnotateFiles( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.asyncBatchAnnotateFiles as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.asyncBatchAnnotateFiles as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asyncBatchAnnotateFiles with call error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateFiles = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.asyncBatchAnnotateFiles(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.asyncBatchAnnotateFiles as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.asyncBatchAnnotateFiles as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asyncBatchAnnotateFiles with LRO error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateFiles = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.asyncBatchAnnotateFiles(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.asyncBatchAnnotateFiles as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.asyncBatchAnnotateFiles as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAsyncBatchAnnotateFilesProgress without error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = - await client.checkAsyncBatchAnnotateFilesProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAsyncBatchAnnotateFilesProgress with error', async () => { - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkAsyncBatchAnnotateFilesProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('Path templates', () => { - describe('product', () => { - const fakePath = '/rendered/path/product'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - }; - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath( - 'projectValue', - 'locationValue', - 'productValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('productSet', () => { - const fakePath = '/rendered/path/productSet'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product_set: 'productSetValue', - }; - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productSetPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productSetPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productSetPath', () => { - const result = client.productSetPath( - 'projectValue', - 'locationValue', - 'productSetValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productSetPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductSetName', () => { - const result = client.matchProjectFromProductSetName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductSetName', () => { - const result = client.matchLocationFromProductSetName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductSetFromProductSetName', () => { - const result = client.matchProductSetFromProductSetName(fakePath); - assert.strictEqual(result, 'productSetValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('referenceImage', () => { - const fakePath = '/rendered/path/referenceImage'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - reference_image: 'referenceImageValue', - }; - const client = new imageannotatorModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.referenceImagePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.referenceImagePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('referenceImagePath', () => { - const result = client.referenceImagePath( - 'projectValue', - 'locationValue', - 'productValue', - 'referenceImageValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.referenceImagePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromReferenceImageName', () => { - const result = client.matchProjectFromReferenceImageName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromReferenceImageName', () => { - const result = client.matchLocationFromReferenceImageName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromReferenceImageName', () => { - const result = client.matchProductFromReferenceImageName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchReferenceImageFromReferenceImageName', () => { - const result = - client.matchReferenceImageFromReferenceImageName(fakePath); - assert.strictEqual(result, 'referenceImageValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - }); -}); diff --git a/test/gapic_image_annotator_v1p1beta1.ts b/test/gapic_image_annotator_v1p1beta1.ts deleted file mode 100644 index 790de938..00000000 --- a/test/gapic_image_annotator_v1p1beta1.ts +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2023 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 protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as imageannotatorModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1p1beta1.ImageAnnotatorClient', () => { - describe('Common methods', () => { - 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); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - await client.initialize(); - assert(client.imageAnnotatorStub); - }); - - it('has close method for the initialized client', done => { - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.imageAnnotatorStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', async () => { - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCall(expectedResponse); - const [response] = await client.batchAnnotateImages(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateImages without error using callback', async () => { - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchAnnotateImages( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateImages with error', async () => { - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.batchAnnotateImages = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - - it('invokes batchAnnotateImages with closed client', async () => { - const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - }); -}); diff --git a/test/gapic_image_annotator_v1p2beta1.ts b/test/gapic_image_annotator_v1p2beta1.ts deleted file mode 100644 index 124129c4..00000000 --- a/test/gapic_image_annotator_v1p2beta1.ts +++ /dev/null @@ -1,424 +0,0 @@ -// Copyright 2023 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 protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as imageannotatorModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v1p2beta1.ImageAnnotatorClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - imageannotatorModule.v1p2beta1.ImageAnnotatorClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - imageannotatorModule.v1p2beta1.ImageAnnotatorClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = imageannotatorModule.v1p2beta1.ImageAnnotatorClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - 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 imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - await client.initialize(); - assert(client.imageAnnotatorStub); - }); - - it('has close method for the initialized client', done => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.imageAnnotatorStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCall(expectedResponse); - const [response] = await client.batchAnnotateImages(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateImages without error using callback', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchAnnotateImages( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateImages with error', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.batchAnnotateImages = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - - it('invokes batchAnnotateImages with closed client', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - }); - - describe('asyncBatchAnnotateFiles', () => { - it('invokes asyncBatchAnnotateFiles without error', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateFiles = - stubLongRunningCall(expectedResponse); - const [operation] = await client.asyncBatchAnnotateFiles(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes asyncBatchAnnotateFiles without error using callback', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateFiles = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asyncBatchAnnotateFiles( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p2beta1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes asyncBatchAnnotateFiles with call error', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateFiles = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.asyncBatchAnnotateFiles(request), - expectedError - ); - }); - - it('invokes asyncBatchAnnotateFiles with LRO error', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateFiles = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.asyncBatchAnnotateFiles(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkAsyncBatchAnnotateFilesProgress without error', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = - await client.checkAsyncBatchAnnotateFilesProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAsyncBatchAnnotateFilesProgress with error', async () => { - const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkAsyncBatchAnnotateFilesProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); -}); diff --git a/test/gapic_image_annotator_v1p3beta1.ts b/test/gapic_image_annotator_v1p3beta1.ts deleted file mode 100644 index ba8d342e..00000000 --- a/test/gapic_image_annotator_v1p3beta1.ts +++ /dev/null @@ -1,631 +0,0 @@ -// Copyright 2023 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 protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as imageannotatorModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v1p3beta1.ImageAnnotatorClient', () => { - describe('Common methods', () => { - 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); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - await client.initialize(); - assert(client.imageAnnotatorStub); - }); - - it('has close method for the initialized client', done => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.imageAnnotatorStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCall(expectedResponse); - const [response] = await client.batchAnnotateImages(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateImages without error using callback', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchAnnotateImages( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateImages with error', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.batchAnnotateImages = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - - it('invokes batchAnnotateImages with closed client', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - }); - - describe('asyncBatchAnnotateFiles', () => { - it('invokes asyncBatchAnnotateFiles without error', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateFiles = - stubLongRunningCall(expectedResponse); - const [operation] = await client.asyncBatchAnnotateFiles(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes asyncBatchAnnotateFiles without error using callback', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateFiles = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asyncBatchAnnotateFiles( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p3beta1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes asyncBatchAnnotateFiles with call error', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateFiles = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.asyncBatchAnnotateFiles(request), - expectedError - ); - }); - - it('invokes asyncBatchAnnotateFiles with LRO error', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateFiles = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.asyncBatchAnnotateFiles(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkAsyncBatchAnnotateFilesProgress without error', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = - await client.checkAsyncBatchAnnotateFilesProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAsyncBatchAnnotateFilesProgress with error', async () => { - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkAsyncBatchAnnotateFilesProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('Path templates', () => { - describe('product', () => { - const fakePath = '/rendered/path/product'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - }; - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath( - 'projectValue', - 'locationValue', - 'productValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('productSet', () => { - const fakePath = '/rendered/path/productSet'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product_set: 'productSetValue', - }; - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productSetPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productSetPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productSetPath', () => { - const result = client.productSetPath( - 'projectValue', - 'locationValue', - 'productSetValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productSetPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductSetName', () => { - const result = client.matchProjectFromProductSetName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductSetName', () => { - const result = client.matchLocationFromProductSetName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductSetFromProductSetName', () => { - const result = client.matchProductSetFromProductSetName(fakePath); - assert.strictEqual(result, 'productSetValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('referenceImage', () => { - const fakePath = '/rendered/path/referenceImage'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - reference_image: 'referenceImageValue', - }; - const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.referenceImagePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.referenceImagePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('referenceImagePath', () => { - const result = client.referenceImagePath( - 'projectValue', - 'locationValue', - 'productValue', - 'referenceImageValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.referenceImagePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromReferenceImageName', () => { - const result = client.matchProjectFromReferenceImageName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromReferenceImageName', () => { - const result = client.matchLocationFromReferenceImageName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromReferenceImageName', () => { - const result = client.matchProductFromReferenceImageName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchReferenceImageFromReferenceImageName', () => { - const result = - client.matchReferenceImageFromReferenceImageName(fakePath); - assert.strictEqual(result, 'referenceImageValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - }); -}); diff --git a/test/gapic_image_annotator_v1p4beta1.ts b/test/gapic_image_annotator_v1p4beta1.ts deleted file mode 100644 index 2219e36b..00000000 --- a/test/gapic_image_annotator_v1p4beta1.ts +++ /dev/null @@ -1,857 +0,0 @@ -// Copyright 2023 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 protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as imageannotatorModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v1p4beta1.ImageAnnotatorClient', () => { - describe('Common methods', () => { - 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); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - await client.initialize(); - assert(client.imageAnnotatorStub); - }); - - it('has close method for the initialized client', done => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.imageAnnotatorStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.imageAnnotatorStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCall(expectedResponse); - const [response] = await client.batchAnnotateImages(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateImages without error using callback', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse() - ); - client.innerApiCalls.batchAnnotateImages = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchAnnotateImages( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateImages with error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.batchAnnotateImages = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - - it('invokes batchAnnotateImages with closed client', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchAnnotateImages(request), expectedError); - }); - }); - - describe('batchAnnotateFiles', () => { - it('invokes batchAnnotateFiles without error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse() - ); - client.innerApiCalls.batchAnnotateFiles = - stubSimpleCall(expectedResponse); - const [response] = await client.batchAnnotateFiles(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateFiles without error using callback', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse() - ); - client.innerApiCalls.batchAnnotateFiles = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchAnnotateFiles( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes batchAnnotateFiles with error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.batchAnnotateFiles = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.batchAnnotateFiles(request), expectedError); - }); - - it('invokes batchAnnotateFiles with closed client', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchAnnotateFiles(request), expectedError); - }); - }); - - describe('asyncBatchAnnotateImages', () => { - it('invokes asyncBatchAnnotateImages without error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateImages = - stubLongRunningCall(expectedResponse); - const [operation] = await client.asyncBatchAnnotateImages(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes asyncBatchAnnotateImages without error using callback', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateImages = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asyncBatchAnnotateImages( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes asyncBatchAnnotateImages with call error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateImages = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.asyncBatchAnnotateImages(request), - expectedError - ); - }); - - it('invokes asyncBatchAnnotateImages with LRO error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateImages = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.asyncBatchAnnotateImages(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkAsyncBatchAnnotateImagesProgress without error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = - await client.checkAsyncBatchAnnotateImagesProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAsyncBatchAnnotateImagesProgress with error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkAsyncBatchAnnotateImagesProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('asyncBatchAnnotateFiles', () => { - it('invokes asyncBatchAnnotateFiles without error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateFiles = - stubLongRunningCall(expectedResponse); - const [operation] = await client.asyncBatchAnnotateFiles(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes asyncBatchAnnotateFiles without error using callback', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.asyncBatchAnnotateFiles = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asyncBatchAnnotateFiles( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, - protos.google.cloud.vision.v1p4beta1.IOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes asyncBatchAnnotateFiles with call error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateFiles = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects( - client.asyncBatchAnnotateFiles(request), - expectedError - ); - }); - - it('invokes asyncBatchAnnotateFiles with LRO error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.asyncBatchAnnotateFiles = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.asyncBatchAnnotateFiles(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkAsyncBatchAnnotateFilesProgress without error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = - await client.checkAsyncBatchAnnotateFilesProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAsyncBatchAnnotateFilesProgress with error', async () => { - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkAsyncBatchAnnotateFilesProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('Path templates', () => { - describe('product', () => { - const fakePath = '/rendered/path/product'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - }; - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath( - 'projectValue', - 'locationValue', - 'productValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('productSet', () => { - const fakePath = '/rendered/path/productSet'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product_set: 'productSetValue', - }; - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productSetPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productSetPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productSetPath', () => { - const result = client.productSetPath( - 'projectValue', - 'locationValue', - 'productSetValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productSetPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductSetName', () => { - const result = client.matchProjectFromProductSetName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductSetName', () => { - const result = client.matchLocationFromProductSetName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductSetFromProductSetName', () => { - const result = client.matchProductSetFromProductSetName(fakePath); - assert.strictEqual(result, 'productSetValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('referenceImage', () => { - const fakePath = '/rendered/path/referenceImage'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - reference_image: 'referenceImageValue', - }; - const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.referenceImagePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.referenceImagePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('referenceImagePath', () => { - const result = client.referenceImagePath( - 'projectValue', - 'locationValue', - 'productValue', - 'referenceImageValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.referenceImagePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromReferenceImageName', () => { - const result = client.matchProjectFromReferenceImageName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromReferenceImageName', () => { - const result = client.matchLocationFromReferenceImageName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromReferenceImageName', () => { - const result = client.matchProductFromReferenceImageName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchReferenceImageFromReferenceImageName', () => { - const result = - client.matchReferenceImageFromReferenceImageName(fakePath); - assert.strictEqual(result, 'referenceImageValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - }); -}); diff --git a/test/gapic_product_search_v1.ts b/test/gapic_product_search_v1.ts deleted file mode 100644 index 6fc4d281..00000000 --- a/test/gapic_product_search_v1.ts +++ /dev/null @@ -1,3862 +0,0 @@ -// Copyright 2023 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 protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as productsearchModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); - } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.ProductSearchClient', () => { - describe('Common methods', () => { - 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); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productSearchStub, undefined); - await client.initialize(); - assert(client.productSearchStub); - }); - - it('has close method for the initialized client', done => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.productSearchStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productSearchStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createProductSet', () => { - it('invokes createProductSet without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ProductSet() - ); - client.innerApiCalls.createProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.createProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ProductSet() - ); - client.innerApiCalls.createProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createProductSet(request), expectedError); - }); - }); - - describe('getProductSet', () => { - it('invokes getProductSet without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ProductSet() - ); - client.innerApiCalls.getProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.getProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ProductSet() - ); - client.innerApiCalls.getProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProductSet(request), expectedError); - }); - }); - - describe('updateProductSet', () => { - it('invokes updateProductSet without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ProductSet() - ); - client.innerApiCalls.updateProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.updateProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ProductSet() - ); - client.innerApiCalls.updateProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.updateProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateProductSet(request), expectedError); - }); - }); - - describe('deleteProductSet', () => { - it('invokes deleteProductSet without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.deleteProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteProductSet(request), expectedError); - }); - }); - - describe('createProduct', () => { - it('invokes createProduct without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.Product() - ); - client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); - const [response] = await client.createProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.Product() - ); - client.innerApiCalls.createProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createProduct(request), expectedError); - }); - }); - - describe('getProduct', () => { - it('invokes getProduct without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.Product() - ); - client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); - const [response] = await client.getProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.Product() - ); - client.innerApiCalls.getProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProduct(request), expectedError); - }); - }); - - describe('updateProduct', () => { - it('invokes updateProduct without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.Product() - ); - client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); - const [response] = await client.updateProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.Product() - ); - client.innerApiCalls.updateProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.updateProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateProduct(request), expectedError); - }); - }); - - describe('deleteProduct', () => { - it('invokes deleteProduct without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); - const [response] = await client.deleteProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProduct( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteProduct(request), expectedError); - }); - }); - - describe('createReferenceImage', () => { - it('invokes createReferenceImage without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ); - client.innerApiCalls.createReferenceImage = - stubSimpleCall(expectedResponse); - const [response] = await client.createReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ); - client.innerApiCalls.createReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IReferenceImage | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createReferenceImage(request), expectedError); - }); - }); - - describe('deleteReferenceImage', () => { - it('invokes deleteReferenceImage without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteReferenceImage = - stubSimpleCall(expectedResponse); - const [response] = await client.deleteReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteReferenceImage(request), expectedError); - }); - }); - - describe('getReferenceImage', () => { - it('invokes getReferenceImage without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ); - client.innerApiCalls.getReferenceImage = stubSimpleCall(expectedResponse); - const [response] = await client.getReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ); - client.innerApiCalls.getReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IReferenceImage | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getReferenceImage(request), expectedError); - }); - }); - - describe('addProductToProductSet', () => { - it('invokes addProductToProductSet without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.addProductToProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.addProductToProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.addProductToProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addProductToProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addProductToProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.addProductToProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects( - client.addProductToProductSet(request), - expectedError - ); - }); - }); - - describe('removeProductFromProductSet', () => { - it('invokes removeProductFromProductSet without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.removeProductFromProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.removeProductFromProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.removeProductFromProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeProductFromProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeProductFromProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.removeProductFromProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet with closed client', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects( - client.removeProductFromProductSet(request), - expectedError - ); - }); - }); - - describe('importProductSets', () => { - it('invokes importProductSets without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProductSets = - stubLongRunningCall(expectedResponse); - const [operation] = await client.importProductSets(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProductSets = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importProductSets( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1.IImportProductSetsResponse, - protos.google.cloud.vision.v1.IBatchOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1.IImportProductSetsResponse, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets with call error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProductSets = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.importProductSets(request), expectedError); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets with LRO error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProductSets = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.importProductSets(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportProductSetsProgress without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportProductSetsProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportProductSetsProgress with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkImportProductSetsProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('purgeProducts', () => { - it('invokes purgeProducts without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.PurgeProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.PurgeProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeProducts = - stubLongRunningCall(expectedResponse); - const [operation] = await client.purgeProducts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.PurgeProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.PurgeProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeProducts = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.purgeProducts( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IBatchOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1.IBatchOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts with call error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.PurgeProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.PurgeProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeProducts = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.purgeProducts(request), expectedError); - const actualRequest = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts with LRO error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.PurgeProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.PurgeProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeProducts = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.purgeProducts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkPurgeProductsProgress without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkPurgeProductsProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPurgeProductsProgress with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkPurgeProductsProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('listProductSets', () => { - it('invokes listProductSets without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - ]; - client.innerApiCalls.listProductSets = stubSimpleCall(expectedResponse); - const [response] = await client.listProductSets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSets without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - ]; - client.innerApiCalls.listProductSets = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProductSets( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProductSet[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSets with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProductSets = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listProductSets(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSetsStream without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - ]; - client.descriptors.page.listProductSets.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductSetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1.ProductSet[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1.ProductSet) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProductSets, request) - ); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductSetsStream with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductSets.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listProductSetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1.ProductSet[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1.ProductSet) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProductSets, request) - ); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductSets without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - generateSampleMessage(new protos.google.cloud.vision.v1.ProductSet()), - ]; - client.descriptors.page.listProductSets.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1.IProductSet[] = []; - const iterable = client.listProductSetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductSets.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProductSets.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductSets with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductSets.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductSetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1.IProductSet[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductSets.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProductSets.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listProducts', () => { - it('invokes listProducts without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - ]; - client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); - const [response] = await client.listProducts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - ]; - client.innerApiCalls.listProducts = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProducts( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProduct[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProducts = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listProducts(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsStream without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - ]; - client.descriptors.page.listProducts.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1.Product[] = []; - stream.on('data', (response: protos.google.cloud.vision.v1.Product) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProducts, request) - ); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductsStream with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1.Product[] = []; - stream.on('data', (response: protos.google.cloud.vision.v1.Product) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProducts, request) - ); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - ]; - client.descriptors.page.listProducts.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1.IProduct[] = []; - const iterable = client.listProductsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1.IProduct[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listReferenceImages', () => { - it('invokes listReferenceImages without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - ]; - client.innerApiCalls.listReferenceImages = - stubSimpleCall(expectedResponse); - const [response] = await client.listReferenceImages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImages without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - ]; - client.innerApiCalls.listReferenceImages = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listReferenceImages( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IReferenceImage[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImages with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listReferenceImages = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listReferenceImages(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImagesStream without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - ]; - client.descriptors.page.listReferenceImages.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listReferenceImagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1.ReferenceImage[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1.ReferenceImage) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listReferenceImages, request) - ); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listReferenceImagesStream with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReferenceImages.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listReferenceImagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1.ReferenceImage[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1.ReferenceImage) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listReferenceImages, request) - ); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReferenceImages without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1.ReferenceImage() - ), - ]; - client.descriptors.page.listReferenceImages.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1.IReferenceImage[] = []; - const iterable = client.listReferenceImagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listReferenceImages.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listReferenceImages.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReferenceImages with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReferenceImages.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReferenceImagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1.IReferenceImage[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listReferenceImages.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listReferenceImages.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listProductsInProductSet', () => { - it('invokes listProductsInProductSet without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - ]; - client.innerApiCalls.listProductsInProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.listProductsInProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSet without error using callback', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - ]; - client.innerApiCalls.listProductsInProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProductsInProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1.IProduct[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSet with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProductsInProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.listProductsInProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSetStream without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - ]; - client.descriptors.page.listProductsInProductSet.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductsInProductSetStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1.Product[] = []; - stream.on('data', (response: protos.google.cloud.vision.v1.Product) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .calledWith(client.innerApiCalls.listProductsInProductSet, request) - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductsInProductSetStream with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductsInProductSet.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listProductsInProductSetStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1.Product[] = []; - stream.on('data', (response: protos.google.cloud.vision.v1.Product) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .calledWith(client.innerApiCalls.listProductsInProductSet, request) - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductsInProductSet without error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - generateSampleMessage(new protos.google.cloud.vision.v1.Product()), - ]; - client.descriptors.page.listProductsInProductSet.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1.IProduct[] = []; - const iterable = client.listProductsInProductSetAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductsInProductSet with error', async () => { - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductsInProductSet.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductsInProductSetAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1.IProduct[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - describe('location', () => { - const fakePath = '/rendered/path/location'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - }; - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.locationPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath('projectValue', 'locationValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('product', () => { - const fakePath = '/rendered/path/product'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - }; - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath( - 'projectValue', - 'locationValue', - 'productValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('productSet', () => { - const fakePath = '/rendered/path/productSet'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product_set: 'productSetValue', - }; - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productSetPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productSetPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productSetPath', () => { - const result = client.productSetPath( - 'projectValue', - 'locationValue', - 'productSetValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productSetPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductSetName', () => { - const result = client.matchProjectFromProductSetName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductSetName', () => { - const result = client.matchLocationFromProductSetName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductSetFromProductSetName', () => { - const result = client.matchProductSetFromProductSetName(fakePath); - assert.strictEqual(result, 'productSetValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('referenceImage', () => { - const fakePath = '/rendered/path/referenceImage'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - reference_image: 'referenceImageValue', - }; - const client = new productsearchModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.referenceImagePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.referenceImagePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('referenceImagePath', () => { - const result = client.referenceImagePath( - 'projectValue', - 'locationValue', - 'productValue', - 'referenceImageValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.referenceImagePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromReferenceImageName', () => { - const result = client.matchProjectFromReferenceImageName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromReferenceImageName', () => { - const result = client.matchLocationFromReferenceImageName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromReferenceImageName', () => { - const result = client.matchProductFromReferenceImageName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchReferenceImageFromReferenceImageName', () => { - const result = - client.matchReferenceImageFromReferenceImageName(fakePath); - assert.strictEqual(result, 'referenceImageValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - }); -}); diff --git a/test/gapic_product_search_v1p3beta1.ts b/test/gapic_product_search_v1p3beta1.ts deleted file mode 100644 index eebe8469..00000000 --- a/test/gapic_product_search_v1p3beta1.ts +++ /dev/null @@ -1,3759 +0,0 @@ -// Copyright 2023 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 protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as productsearchModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); - } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1p3beta1.ProductSearchClient', () => { - describe('Common methods', () => { - 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); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productSearchStub, undefined); - await client.initialize(); - assert(client.productSearchStub); - }); - - it('has close method for the initialized client', done => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.productSearchStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productSearchStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createProductSet', () => { - it('invokes createProductSet without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ); - client.innerApiCalls.createProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.createProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ); - client.innerApiCalls.createProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createProductSet(request), expectedError); - }); - }); - - describe('getProductSet', () => { - it('invokes getProductSet without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ); - client.innerApiCalls.getProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.getProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ); - client.innerApiCalls.getProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProductSet(request), expectedError); - }); - }); - - describe('updateProductSet', () => { - it('invokes updateProductSet without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ); - client.innerApiCalls.updateProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.updateProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ); - client.innerApiCalls.updateProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.updateProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateProductSet(request), expectedError); - }); - }); - - describe('deleteProductSet', () => { - it('invokes deleteProductSet without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.deleteProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteProductSet(request), expectedError); - }); - }); - - describe('createProduct', () => { - it('invokes createProduct without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ); - client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); - const [response] = await client.createProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ); - client.innerApiCalls.createProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createProduct(request), expectedError); - }); - }); - - describe('getProduct', () => { - it('invokes getProduct without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ); - client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); - const [response] = await client.getProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ); - client.innerApiCalls.getProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProduct(request), expectedError); - }); - }); - - describe('updateProduct', () => { - it('invokes updateProduct without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ); - client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); - const [response] = await client.updateProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ); - client.innerApiCalls.updateProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.updateProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateProduct(request), expectedError); - }); - }); - - describe('deleteProduct', () => { - it('invokes deleteProduct without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); - const [response] = await client.deleteProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProduct( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteProduct(request), expectedError); - }); - }); - - describe('createReferenceImage', () => { - it('invokes createReferenceImage without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ); - client.innerApiCalls.createReferenceImage = - stubSimpleCall(expectedResponse); - const [response] = await client.createReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ); - client.innerApiCalls.createReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IReferenceImage | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createReferenceImage(request), expectedError); - }); - }); - - describe('deleteReferenceImage', () => { - it('invokes deleteReferenceImage without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteReferenceImage = - stubSimpleCall(expectedResponse); - const [response] = await client.deleteReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteReferenceImage(request), expectedError); - }); - }); - - describe('getReferenceImage', () => { - it('invokes getReferenceImage without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ); - client.innerApiCalls.getReferenceImage = stubSimpleCall(expectedResponse); - const [response] = await client.getReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ); - client.innerApiCalls.getReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IReferenceImage | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getReferenceImage(request), expectedError); - }); - }); - - describe('addProductToProductSet', () => { - it('invokes addProductToProductSet without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.addProductToProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.addProductToProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.addProductToProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addProductToProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addProductToProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.addProductToProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects( - client.addProductToProductSet(request), - expectedError - ); - }); - }); - - describe('removeProductFromProductSet', () => { - it('invokes removeProductFromProductSet without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.removeProductFromProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.removeProductFromProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.removeProductFromProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeProductFromProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeProductFromProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.removeProductFromProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet with closed client', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects( - client.removeProductFromProductSet(request), - expectedError - ); - }); - }); - - describe('importProductSets', () => { - it('invokes importProductSets without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProductSets = - stubLongRunningCall(expectedResponse); - const [operation] = await client.importProductSets(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProductSets = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importProductSets( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.IBatchOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p3beta1.IBatchOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets with call error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProductSets = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.importProductSets(request), expectedError); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets with LRO error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProductSets = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.importProductSets(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportProductSetsProgress without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportProductSetsProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportProductSetsProgress with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkImportProductSetsProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('listProductSets', () => { - it('invokes listProductSets without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - ]; - client.innerApiCalls.listProductSets = stubSimpleCall(expectedResponse); - const [response] = await client.listProductSets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSets without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - ]; - client.innerApiCalls.listProductSets = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProductSets( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProductSet[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSets with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProductSets = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listProductSets(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSetsStream without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - ]; - client.descriptors.page.listProductSets.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductSetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p3beta1.ProductSet[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p3beta1.ProductSet) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProductSets, request) - ); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductSetsStream with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductSets.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listProductSetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p3beta1.ProductSet[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p3beta1.ProductSet) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProductSets, request) - ); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductSets without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ProductSet() - ), - ]; - client.descriptors.page.listProductSets.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1p3beta1.IProductSet[] = []; - const iterable = client.listProductSetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductSets.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProductSets.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductSets with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductSets.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductSetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1p3beta1.IProductSet[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductSets.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProductSets.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listProducts', () => { - it('invokes listProducts without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - ]; - client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); - const [response] = await client.listProducts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - ]; - client.innerApiCalls.listProducts = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProducts( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProduct[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProducts = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listProducts(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsStream without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - ]; - client.descriptors.page.listProducts.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p3beta1.Product[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p3beta1.Product) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProducts, request) - ); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductsStream with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p3beta1.Product[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p3beta1.Product) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProducts, request) - ); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - ]; - client.descriptors.page.listProducts.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1p3beta1.IProduct[] = []; - const iterable = client.listProductsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1p3beta1.IProduct[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listReferenceImages', () => { - it('invokes listReferenceImages without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - ]; - client.innerApiCalls.listReferenceImages = - stubSimpleCall(expectedResponse); - const [response] = await client.listReferenceImages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImages without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - ]; - client.innerApiCalls.listReferenceImages = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listReferenceImages( - request, - ( - err?: Error | null, - result?: - | protos.google.cloud.vision.v1p3beta1.IReferenceImage[] - | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImages with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listReferenceImages = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listReferenceImages(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImagesStream without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - ]; - client.descriptors.page.listReferenceImages.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listReferenceImagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p3beta1.ReferenceImage[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p3beta1.ReferenceImage) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listReferenceImages, request) - ); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listReferenceImagesStream with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReferenceImages.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listReferenceImagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p3beta1.ReferenceImage[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p3beta1.ReferenceImage) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listReferenceImages, request) - ); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReferenceImages without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ReferenceImage() - ), - ]; - client.descriptors.page.listReferenceImages.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1p3beta1.IReferenceImage[] = - []; - const iterable = client.listReferenceImagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listReferenceImages.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listReferenceImages.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReferenceImages with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReferenceImages.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReferenceImagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1p3beta1.IReferenceImage[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listReferenceImages.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listReferenceImages.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listProductsInProductSet', () => { - it('invokes listProductsInProductSet without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - ]; - client.innerApiCalls.listProductsInProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.listProductsInProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSet without error using callback', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - ]; - client.innerApiCalls.listProductsInProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProductsInProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p3beta1.IProduct[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSet with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProductsInProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.listProductsInProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSetStream without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - ]; - client.descriptors.page.listProductsInProductSet.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductsInProductSetStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p3beta1.Product[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p3beta1.Product) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .calledWith(client.innerApiCalls.listProductsInProductSet, request) - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductsInProductSetStream with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductsInProductSet.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listProductsInProductSetStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p3beta1.Product[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p3beta1.Product) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .calledWith(client.innerApiCalls.listProductsInProductSet, request) - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductsInProductSet without error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.Product() - ), - ]; - client.descriptors.page.listProductsInProductSet.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1p3beta1.IProduct[] = []; - const iterable = client.listProductsInProductSetAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductsInProductSet with error', async () => { - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductsInProductSet.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductsInProductSetAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1p3beta1.IProduct[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - describe('location', () => { - const fakePath = '/rendered/path/location'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - }; - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.locationPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath('projectValue', 'locationValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('product', () => { - const fakePath = '/rendered/path/product'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - }; - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath( - 'projectValue', - 'locationValue', - 'productValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('productSet', () => { - const fakePath = '/rendered/path/productSet'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product_set: 'productSetValue', - }; - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productSetPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productSetPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productSetPath', () => { - const result = client.productSetPath( - 'projectValue', - 'locationValue', - 'productSetValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productSetPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductSetName', () => { - const result = client.matchProjectFromProductSetName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductSetName', () => { - const result = client.matchLocationFromProductSetName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductSetFromProductSetName', () => { - const result = client.matchProductSetFromProductSetName(fakePath); - assert.strictEqual(result, 'productSetValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('referenceImage', () => { - const fakePath = '/rendered/path/referenceImage'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - reference_image: 'referenceImageValue', - }; - const client = new productsearchModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.referenceImagePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.referenceImagePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('referenceImagePath', () => { - const result = client.referenceImagePath( - 'projectValue', - 'locationValue', - 'productValue', - 'referenceImageValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.referenceImagePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromReferenceImageName', () => { - const result = client.matchProjectFromReferenceImageName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromReferenceImageName', () => { - const result = client.matchLocationFromReferenceImageName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromReferenceImageName', () => { - const result = client.matchProductFromReferenceImageName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchReferenceImageFromReferenceImageName', () => { - const result = - client.matchReferenceImageFromReferenceImageName(fakePath); - assert.strictEqual(result, 'referenceImageValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - }); -}); diff --git a/test/gapic_product_search_v1p4beta1.ts b/test/gapic_product_search_v1p4beta1.ts deleted file mode 100644 index 083304e6..00000000 --- a/test/gapic_product_search_v1p4beta1.ts +++ /dev/null @@ -1,3953 +0,0 @@ -// Copyright 2023 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 protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as productsearchModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json') -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().rejects(callError) - : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback( - response?: ResponseType, - callError?: Error, - lroError?: Error -) { - const innerStub = lroError - ? sinon.stub().rejects(lroError) - : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError - ? sinon.stub().callsArgWith(2, callError) - : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); - } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1p4beta1.ProductSearchClient', () => { - describe('Common methods', () => { - 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); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productSearchStub, undefined); - await client.initialize(); - assert(client.productSearchStub); - }); - - it('has close method for the initialized client', done => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.productSearchStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productSearchStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createProductSet', () => { - it('invokes createProductSet without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ); - client.innerApiCalls.createProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.createProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ); - client.innerApiCalls.createProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProductSet with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateProductSetRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createProductSet(request), expectedError); - }); - }); - - describe('getProductSet', () => { - it('invokes getProductSet without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ); - client.innerApiCalls.getProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.getProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ); - client.innerApiCalls.getProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProductSet with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProductSet(request), expectedError); - }); - }); - - describe('updateProductSet', () => { - it('invokes updateProductSet without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ); - client.innerApiCalls.updateProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.updateProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ); - client.innerApiCalls.updateProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProductSet | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedHeaderRequestParams = `product_set.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.updateProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProductSet with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.UpdateProductSetRequest() - ); - request.productSet ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.UpdateProductSetRequest', - ['productSet', 'name'] - ); - request.productSet.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateProductSet(request), expectedError); - }); - }); - - describe('deleteProductSet', () => { - it('invokes deleteProductSet without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProductSet = stubSimpleCall(expectedResponse); - const [response] = await client.deleteProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteProductSet(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProductSet with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteProductSet(request), expectedError); - }); - }); - - describe('createProduct', () => { - it('invokes createProduct without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ); - client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); - const [response] = await client.createProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ); - client.innerApiCalls.createProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateProductRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createProduct(request), expectedError); - }); - }); - - describe('getProduct', () => { - it('invokes getProduct without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ); - client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); - const [response] = await client.getProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ); - client.innerApiCalls.getProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getProduct(request), expectedError); - }); - }); - - describe('updateProduct', () => { - it('invokes updateProduct without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ); - client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); - const [response] = await client.updateProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ); - client.innerApiCalls.updateProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProduct( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProduct | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.updateProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.UpdateProductRequest', - ['product', 'name'] - ); - request.product.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateProduct(request), expectedError); - }); - }); - - describe('deleteProduct', () => { - it('invokes deleteProduct without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); - const [response] = await client.deleteProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProduct( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProduct = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteProduct(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProduct as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteProductRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteProductRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteProduct(request), expectedError); - }); - }); - - describe('createReferenceImage', () => { - it('invokes createReferenceImage without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ); - client.innerApiCalls.createReferenceImage = - stubSimpleCall(expectedResponse); - const [response] = await client.createReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ); - client.innerApiCalls.createReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IReferenceImage | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.createReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReferenceImage with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.CreateReferenceImageRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createReferenceImage(request), expectedError); - }); - }); - - describe('deleteReferenceImage', () => { - it('invokes deleteReferenceImage without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteReferenceImage = - stubSimpleCall(expectedResponse); - const [response] = await client.deleteReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.deleteReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteReferenceImage with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteReferenceImage(request), expectedError); - }); - }); - - describe('getReferenceImage', () => { - it('invokes getReferenceImage without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ); - client.innerApiCalls.getReferenceImage = stubSimpleCall(expectedResponse); - const [response] = await client.getReferenceImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ); - client.innerApiCalls.getReferenceImage = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReferenceImage( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IReferenceImage | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getReferenceImage = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.getReferenceImage(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getReferenceImage as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getReferenceImage with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.GetReferenceImageRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.GetReferenceImageRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getReferenceImage(request), expectedError); - }); - }); - - describe('addProductToProductSet', () => { - it('invokes addProductToProductSet without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.addProductToProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.addProductToProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.addProductToProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addProductToProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addProductToProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.addProductToProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addProductToProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addProductToProductSet with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.AddProductToProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects( - client.addProductToProductSet(request), - expectedError - ); - }); - }); - - describe('removeProductFromProductSet', () => { - it('invokes removeProductFromProductSet without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.removeProductFromProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.removeProductFromProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.removeProductFromProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeProductFromProductSet( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeProductFromProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.removeProductFromProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.removeProductFromProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeProductFromProductSet with closed client', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects( - client.removeProductFromProductSet(request), - expectedError - ); - }); - }); - - describe('importProductSets', () => { - it('invokes importProductSets without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProductSets = - stubLongRunningCall(expectedResponse); - const [operation] = await client.importProductSets(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProductSets = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importProductSets( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets with call error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProductSets = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.importProductSets(request), expectedError); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProductSets with LRO error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ImportProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ImportProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProductSets = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.importProductSets(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.importProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportProductSetsProgress without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportProductSetsProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportProductSetsProgress with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkImportProductSetsProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('purgeProducts', () => { - it('invokes purgeProducts without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.PurgeProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.PurgeProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeProducts = - stubLongRunningCall(expectedResponse); - const [operation] = await client.purgeProducts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.PurgeProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.PurgeProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeProducts = - stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.purgeProducts( - request, - ( - err?: Error | null, - result?: LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - > | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const operation = (await promise) as LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata - >; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts with call error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.PurgeProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.PurgeProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeProducts = stubLongRunningCall( - undefined, - expectedError - ); - await assert.rejects(client.purgeProducts(request), expectedError); - const actualRequest = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts with LRO error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.PurgeProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.PurgeProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeProducts = stubLongRunningCall( - undefined, - undefined, - expectedError - ); - const [operation] = await client.purgeProducts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.purgeProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkPurgeProductsProgress without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkPurgeProductsProgress( - expectedResponse.name - ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPurgeProductsProgress with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.checkPurgeProductsProgress(''), - expectedError - ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - }); - - describe('listProductSets', () => { - it('invokes listProductSets without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - ]; - client.innerApiCalls.listProductSets = stubSimpleCall(expectedResponse); - const [response] = await client.listProductSets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSets without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - ]; - client.innerApiCalls.listProductSets = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProductSets( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProductSet[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSets with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProductSets = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listProductSets(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductSets as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductSetsStream without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - ]; - client.descriptors.page.listProductSets.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductSetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p4beta1.ProductSet[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p4beta1.ProductSet) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProductSets, request) - ); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductSetsStream with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductSets.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listProductSetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p4beta1.ProductSet[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p4beta1.ProductSet) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProductSets, request) - ); - assert( - (client.descriptors.page.listProductSets.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductSets without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ProductSet() - ), - ]; - client.descriptors.page.listProductSets.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1p4beta1.IProductSet[] = []; - const iterable = client.listProductSetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductSets.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProductSets.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductSets with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductSetsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductSetsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductSets.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductSetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1p4beta1.IProductSet[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductSets.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProductSets.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listProducts', () => { - it('invokes listProducts without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - ]; - client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); - const [response] = await client.listProducts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - ]; - client.innerApiCalls.listProducts = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProducts( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProduct[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProducts = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listProducts(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProducts as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsStream without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - ]; - client.descriptors.page.listProducts.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p4beta1.Product[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p4beta1.Product) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProducts, request) - ); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductsStream with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p4beta1.Product[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p4beta1.Product) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProducts, request) - ); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - ]; - client.descriptors.page.listProducts.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1p4beta1.IProduct[] = []; - const iterable = client.listProductsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1p4beta1.IProduct[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProducts.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listReferenceImages', () => { - it('invokes listReferenceImages without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - ]; - client.innerApiCalls.listReferenceImages = - stubSimpleCall(expectedResponse); - const [response] = await client.listReferenceImages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImages without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - ]; - client.innerApiCalls.listReferenceImages = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listReferenceImages( - request, - ( - err?: Error | null, - result?: - | protos.google.cloud.vision.v1p4beta1.IReferenceImage[] - | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImages with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listReferenceImages = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(client.listReferenceImages(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listReferenceImages as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listReferenceImagesStream without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - ]; - client.descriptors.page.listReferenceImages.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listReferenceImagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p4beta1.ReferenceImage[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p4beta1.ReferenceImage) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listReferenceImages, request) - ); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listReferenceImagesStream with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReferenceImages.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listReferenceImagesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p4beta1.ReferenceImage[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p4beta1.ReferenceImage) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listReferenceImages, request) - ); - assert( - (client.descriptors.page.listReferenceImages.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReferenceImages without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ReferenceImage() - ), - ]; - client.descriptors.page.listReferenceImages.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1p4beta1.IReferenceImage[] = - []; - const iterable = client.listReferenceImagesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listReferenceImages.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listReferenceImages.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReferenceImages with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListReferenceImagesRequest', - ['parent'] - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listReferenceImages.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReferenceImagesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1p4beta1.IReferenceImage[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listReferenceImages.asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - (client.descriptors.page.listReferenceImages.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listProductsInProductSet', () => { - it('invokes listProductsInProductSet without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - ]; - client.innerApiCalls.listProductsInProductSet = - stubSimpleCall(expectedResponse); - const [response] = await client.listProductsInProductSet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSet without error using callback', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - ]; - client.innerApiCalls.listProductsInProductSet = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProductsInProductSet( - request, - ( - err?: Error | null, - result?: protos.google.cloud.vision.v1p4beta1.IProduct[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSet with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProductsInProductSet = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects( - client.listProductsInProductSet(request), - expectedError - ); - const actualRequest = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listProductsInProductSet as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsInProductSetStream without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - ]; - client.descriptors.page.listProductsInProductSet.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listProductsInProductSetStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p4beta1.Product[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p4beta1.Product) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .calledWith(client.innerApiCalls.listProductsInProductSet, request) - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductsInProductSetStream with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductsInProductSet.createStream = - stubPageStreamingCall(undefined, expectedError); - const stream = client.listProductsInProductSetStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vision.v1p4beta1.Product[] = []; - stream.on( - 'data', - (response: protos.google.cloud.vision.v1p4beta1.Product) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .calledWith(client.innerApiCalls.listProductsInProductSet, request) - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .createStream as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductsInProductSet without error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.Product() - ), - ]; - client.descriptors.page.listProductsInProductSet.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vision.v1p4beta1.IProduct[] = []; - const iterable = client.listProductsInProductSetAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProductsInProductSet with error', async () => { - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest() - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest', - ['name'] - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listProductsInProductSet.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductsInProductSetAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vision.v1p4beta1.IProduct[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - assert( - ( - client.descriptors.page.listProductsInProductSet - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - describe('location', () => { - const fakePath = '/rendered/path/location'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - }; - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.locationPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath('projectValue', 'locationValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('product', () => { - const fakePath = '/rendered/path/product'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - }; - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath( - 'projectValue', - 'locationValue', - 'productValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('productSet', () => { - const fakePath = '/rendered/path/productSet'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product_set: 'productSetValue', - }; - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.productSetPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.productSetPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('productSetPath', () => { - const result = client.productSetPath( - 'projectValue', - 'locationValue', - 'productSetValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.productSetPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromProductSetName', () => { - const result = client.matchProjectFromProductSetName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromProductSetName', () => { - const result = client.matchLocationFromProductSetName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductSetFromProductSetName', () => { - const result = client.matchProductSetFromProductSetName(fakePath); - assert.strictEqual(result, 'productSetValue'); - assert( - (client.pathTemplates.productSetPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - - describe('referenceImage', () => { - const fakePath = '/rendered/path/referenceImage'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - product: 'productValue', - reference_image: 'referenceImageValue', - }; - const client = new productsearchModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.referenceImagePathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.referenceImagePathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('referenceImagePath', () => { - const result = client.referenceImagePath( - 'projectValue', - 'locationValue', - 'productValue', - 'referenceImageValue' - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.referenceImagePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromReferenceImageName', () => { - const result = client.matchProjectFromReferenceImageName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchLocationFromReferenceImageName', () => { - const result = client.matchLocationFromReferenceImageName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchProductFromReferenceImageName', () => { - const result = client.matchProductFromReferenceImageName(fakePath); - assert.strictEqual(result, 'productValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchReferenceImageFromReferenceImageName', () => { - const result = - client.matchReferenceImageFromReferenceImageName(fakePath); - assert.strictEqual(result, 'referenceImageValue'); - assert( - (client.pathTemplates.referenceImagePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - }); -}); diff --git a/test/helpers.test.ts b/test/helpers.test.ts deleted file mode 100644 index e32e76e5..00000000 --- a/test/helpers.test.ts +++ /dev/null @@ -1,539 +0,0 @@ -/*! - * 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. - */ - -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'; -// eslint-disable-next-line @typescript-eslint/no-var-requires -const vision = require('../src'); - -describe('Vision helper methods', () => { - const CREDENTIALS = { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }; - - const sandbox = sinon.createSandbox(); - - afterEach(() => { - sandbox.restore(); - }); - - describe('annotateImage', () => { - it('calls batchAnnotateImages correctly', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // Ensure that the annotateImage method arrifies the request and - // passes it through to the batch annotation method. - const request = { - image: {content: Buffer.from('bogus==')}, - features: {type: ['LOGO_DETECTION']}, - }; - - 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', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - - // Stub out the batch annotation method. - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // Ensure that the annotateImage method arrifies the request and - // passes it through to the batch annotation method. - const request = { - image: Buffer.from('fakeImage'), - features: {type: ['LOGO_DETECTION']}, - }; - 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 the batch annotation method as before. - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // 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: imagePath}}, - features: {type: ['LOGO_DETECTION']}, - }; - 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); - // 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).catch((err: string) => { - assert( - err.toString().match(/Error: ENOENT: no such file or directory/) - ); - }); - }); - - it('retains call options sent', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // Ensure that the annotateImage method arrifies the request and - // passes it through to the batch annotation method. - const request = { - image: {content: Buffer.from('bogus==')}, - features: {type: ['LOGO_DETECTION']}, - }; - 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 => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // Ensure that the annotateImage method does *not* pass the callback - // on to batchAnnotateImages, but rather handles it itself. - const request = { - image: {content: Buffer.from('bogus==')}, - features: {type: ['LOGO_DETECTION']}, - }; - client.annotateImage(request, (err: {}, response: {}) => { - // Establish that we got the expected response. - assert(is.undefined(err)); - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - - // Inspect the calls to batchAnnotate and ensure that they match - // what we expected. - assert(batchAnnotate.callCount === 1); - assert(batchAnnotate.calledWith({requests: [request]}, undefined)); - done(); - }); - }); - - it('fires the callback on error', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, {message: 'Bad things!'}); - - // Ensure that the annotateImage method does *not* pass the callback - // on to batchAnnotateImages, but rather handles it itself. - const request = { - image: {content: Buffer.from('bogus==')}, - features: {type: ['LOGO_DETECTION']}, - }; - return client.annotateImage(request).catch((err: {}) => { - // Establish that we got the expected response. - assert.deepStrictEqual(err, {message: 'Bad things!'}); - - // Inspect the calls to batchAnnotate and ensure that they match - // what we expected. - assert(batchAnnotate.callCount === 1); - assert(batchAnnotate.calledWith({requests: [request]}, undefined)); - }); - }); - - it('requires an image and throws without one', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - const request = {}; - return client.annotateImage(request).catch((err: string) => { - assert(err.toString().match(/Error: No image present./)); - }); - }); - }); - - describe('single-feature methods', () => { - it('call `annotateImage` with the correct feature', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - const annotate = sandbox.spy(client, 'annotateImage'); - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // 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: [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', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - - // Stub out the batch annotation method. - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // Call a request to a single-feature method using a URL. - 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', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - - // Stub out the batch annotation method. - const annotate = sandbox.stub(client, 'annotateImage'); - annotate.callsArgWith(2, undefined, { - logoAnnotations: [{description: 'Google'}], - }); - - // Call a request to a single-feature method using a URL. - return client.logoDetection('/path/to/logo.png').then((response: {}) => { - // Ensure we got the slice of the response that we expected. - assert.deepStrictEqual(response, [ - { - logoAnnotations: [{description: 'Google'}], - }, - ]); - - // Inspect the calls to annotateImages and ensure they matched - // the expected signature. - assert(annotate.callCount === 1); - assert( - annotate.calledWith({ - image: {source: {filename: '/path/to/logo.png'}}, - features: [{type: 3}], - }) - ); - }); - }); - - it('understand a buffer sent directly', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - - // Stub out the batch annotation method. - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // 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: [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', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - const opts = {foo: 'bar'}; - - // Stub out the batchAnnotateImages method as usual. - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - logoAnnotations: [{description: 'Google'}], - }, - ], - }); - - // 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: [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', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - const imageRequest = { - image: {content: Buffer.from('bogus==')}, - features: [{type: 0}], - }; - client.logoDetection(imageRequest).catch((err: string) => { - assert(err.toString().match(/Setting explicit/)); - }); - }); - - it('creates and promisify methods that are available in certain versions', () => { - const client = new vision.v1p3beta1.ImageAnnotatorClient(CREDENTIALS); - const request = { - image: { - source: { - imageUri: 'https://cloud.google.com/vision/docs/images/bicycle.jpg', - }, - }, - }; - const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); - batchAnnotate.callsArgWith(2, undefined, { - responses: [ - { - localizedObjectAnnotations: [{dummy: 'response'}], - }, - ], - }); - - client - .productSearch(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); - if (typeof client['objectLocalization'] === 'function') { - assert.fail('objectLocalization does not exist in v1p1beta1'); - } - }); - }); -}); diff --git a/test/index.test.ts b/test/index.test.ts deleted file mode 100644 index ec8dc564..00000000 --- a/test/index.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -// 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 -// -// 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. - -import * as assert from 'assert'; -import {describe, it} from 'mocha'; -// eslint-disable-next-line @typescript-eslint/no-var-requires -const vision = require('../src'); - -describe('Vision', () => { - const CREDENTIALS = { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }; - - describe('v1', () => { - it('returns a v1 GAPIC augmented with helpers', () => { - const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - - // Assert that the GAPIC v1 methods are present on the object. - assert(client.batchAnnotateImages instanceof Function); - - // Assert that the manual single-image helper method is present - // on the object. - assert(client.annotateImage instanceof Function); - - // Assert that some of the expected single-feature helper methods - // are present on the object. - assert(client.faceDetection instanceof Function); - assert(client.landmarkDetection instanceof Function); - assert(client.logoDetection instanceof Function); - assert(client.labelDetection instanceof Function); - assert(client.textDetection instanceof Function); - assert(client.documentTextDetection instanceof Function); - assert(client.safeSearchDetection instanceof Function); - assert(client.imageProperties instanceof Function); - assert(client.cropHints instanceof Function); - assert(client.webDetection instanceof Function); - }); - }); -}); diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 2f155600..00000000 --- a/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'vision', - filename: './vision.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - 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[\\/]gtoken/, - use: 'null-loader', - }, - ], - }, - mode: 'production', -};